SOFARPC 支持指定地址进行调用的场景。使用 Java API 的方式如下,设置直连地址即可。
ConsumerConfig<HelloService> consumer =new ConsumerConfig<HelloService>()
.setInterfaceId(HelloService.class.getName())
.setRegistry(registryConfig)
.setDirectUrl("bolt://127.0.0.1:12201");
用 XML 的使用方式如下:
<sofa:reference interface="com.alipay.sample.HelloService" id="helloService">
<sofa:binding.bolt>
<sofa:route target-url="127.0.0.1:12200"/>
</sofa:binding.bolt>
</sofa:reference>
使用 Annotation 的方式如下:
@SofaReference(binding =@SofaReferenceBinding(bindingType ="bolt", directUrl ="127.0.0.1:12220"))
private SampleService sampleService;
在文档使用中是否遇到以下问题
更多建议
匿名提交