Search in sources :

Example 1 with ServiceBImpl

use of com.alipay.sofa.rpc.asynchain.ServiceBImpl in project sofa-rpc by sofastack.

the class ServerB method main.

public static void main(String[] args) {
    // B服务里的C服务客户端
    ConsumerConfig<ServiceC> consumerConfig = new ConsumerConfig<ServiceC>().setApplication(new ApplicationConfig().setAppName("BBB")).setInterfaceId(ServiceC.class.getName()).setDirectUrl("bolt://127.0.0.1:12299?appName=CCC").setRegister(false).setInvokeType(// 不设置,调用级别可设置
    "callback").setTimeout(2000);
    ServiceC serviceC = consumerConfig.refer();
    ServerConfig serverConfig = new ServerConfig().setPort(12298).setDaemon(false);
    ProviderConfig<ServiceB> providerConfig = new ProviderConfig<ServiceB>().setInterfaceId(ServiceB.class.getName()).setApplication(new ApplicationConfig().setAppName("BBB")).setRef(new ServiceBImpl(serviceC)).setServer(serverConfig).setRegister(false);
    providerConfig.export();
}
Also used : ServiceC(com.alipay.sofa.rpc.asynchain.ServiceC) ServerConfig(com.alipay.sofa.rpc.config.ServerConfig) ServiceB(com.alipay.sofa.rpc.asynchain.ServiceB) ApplicationConfig(com.alipay.sofa.rpc.config.ApplicationConfig) ServiceBImpl(com.alipay.sofa.rpc.asynchain.ServiceBImpl) ConsumerConfig(com.alipay.sofa.rpc.config.ConsumerConfig)

Aggregations

ServiceB (com.alipay.sofa.rpc.asynchain.ServiceB)1 ServiceBImpl (com.alipay.sofa.rpc.asynchain.ServiceBImpl)1 ServiceC (com.alipay.sofa.rpc.asynchain.ServiceC)1 ApplicationConfig (com.alipay.sofa.rpc.config.ApplicationConfig)1 ConsumerConfig (com.alipay.sofa.rpc.config.ConsumerConfig)1 ServerConfig (com.alipay.sofa.rpc.config.ServerConfig)1