文档

H2C 协议的基本使用

更新时间:

在 SOFARPC 中,使用不同的通信协议只要设置使用不同的 Binding 即可。如果需要使用 H2C 协议,只要将 Binding 设置为 H2C。

本文以注解的使用方式为例,其他使用方式可以参考 BOLT 协议基本使用

发布服务

发布一个 H2C 的服务,只需要将 @SofaServiceBindingbindingType 设置为 h2c

@Service
@SofaService(bindings ={@SofaServiceBinding(bindingType ="h2c")})
public class SampleServiceImpl implements SampleService{
}

引用服务

引用一个 H2C 的服务,只需要将 @SofaReferenceBindingbindingType 设置为 h2c

@SofaReference(binding =@SofaReferenceBinding(bindingType ="h2c"), jvmFirst =false)
private SampleService sampleService;
  • 本页导读 (0)
文档反馈