Java Code Examples for org.apache.dubbo.config.ProtocolConfig#setPort()
The following examples show how to use
org.apache.dubbo.config.ProtocolConfig#setPort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Application.java From dubbo-samples with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { ServiceConfig<UserService> service = new ServiceConfig<>(); service.setInterface(UserService.class); service.setRef(new UserServiceImpl()); ProtocolConfig protocolConfig = new ProtocolConfig("rest"); protocolConfig.setPort(8090); DubboBootstrap bootstrap = DubboBootstrap.getInstance(); bootstrap.application(new ApplicationConfig("dubbo-provider-for-sc")) .registry(new RegistryConfig("consul://127.0.0.1:8500?registry-type=service")) .protocol(protocolConfig) .service(service) .start() .await(); }
Example 2
Source File: ApacheDubboInstrumentationTest.java From apm-agent-java with Apache License 2.0 | 4 votes |
@Override protected DubboTestApi buildDubboTestApi() { ApplicationConfig providerAppConfig = new ApplicationConfig(); providerAppConfig.setName("dubbo-demo"); ProtocolConfig protocolConfig = new ProtocolConfig(); protocolConfig.setName("dubbo"); protocolConfig.setPort(getPort()); protocolConfig.setThreads(10); RegistryConfig registryConfig = new RegistryConfig(); registryConfig.setAddress("N/A"); serviceConfig = new ServiceConfig<>(); serviceConfig.setApplication(providerAppConfig); serviceConfig.setProtocol(protocolConfig); serviceConfig.setInterface(DubboTestApi.class); serviceConfig.setRef(new DubboTestApiImpl()); serviceConfig.setRegistry(registryConfig); serviceConfig.export(); referenceConfig = new ReferenceConfig<>(); referenceConfig.setApplication(providerAppConfig); referenceConfig.setInterface(DubboTestApi.class); referenceConfig.setUrl("dubbo://localhost:" + getPort()); referenceConfig.setTimeout(3000); List<MethodConfig> methodConfigList = new LinkedList<>(); referenceConfig.setMethods(methodConfigList); MethodConfig asyncConfig = new MethodConfig(); asyncConfig.setName("async"); asyncConfig.setAsync(true); methodConfigList.add(asyncConfig); MethodConfig asyncNoReturnConfig = new MethodConfig(); asyncNoReturnConfig.setName("asyncNoReturn"); asyncNoReturnConfig.setAsync(true); asyncNoReturnConfig.setReturn(false); methodConfigList.add(asyncNoReturnConfig); return referenceConfig.get(); }