Search in sources :

Example 1 with FaultHelloService

use of com.alipay.sofa.rpc.client.aft.bean.FaultHelloService in project sofa-rpc by sofastack.

the class FaultBaseTest method init.

@Before
public void init() {
    // 只有1个线程 执行
    serverConfig = new ServerConfig().setStopTimeout(60000).setPort(12299).setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT).setQueues(100).setCoreThreads(10).setMaxThreads(20);
    ApplicationConfig providerAconfig = new ApplicationConfig();
    providerAconfig.setAppName("testApp");
    // 发布一个服务,每个请求要执行1秒
    providerConfig = new ProviderConfig<FaultHelloService>().setInterfaceId(FaultHelloService.class.getName()).setRef(new HelloServiceTimeOutImpl()).setServer(serverConfig).setRegister(false).setApplication(providerAconfig);
    // just for test
    consumerConfigNotUse = new ConsumerConfig<FaultHelloService>().setInterfaceId(FaultHelloService.class.getName()).setTimeout(500).setDirectUrl("127.0.0.1:12299").setRegister(false).setUniqueId("xxx").setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT);
    ApplicationConfig applicationConfig = new ApplicationConfig();
    applicationConfig.setAppName(APP_NAME1);
    consumerConfig = new ConsumerConfig<FaultHelloService>().setInterfaceId(FaultHelloService.class.getName()).setTimeout(500).setDirectUrl("127.0.0.1:12299").setRegister(false).setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT).setApplication(applicationConfig);
    consumerConfig2 = new ConsumerConfig<FaultHelloService2>().setInterfaceId(FaultHelloService2.class.getName()).setTimeout(500).setDirectUrl("127.0.0.1:12299").setRegister(false).setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT).setApplication(applicationConfig);
    consumerConfigAnotherApp = new ConsumerConfig<FaultHelloService>().setInterfaceId(FaultHelloService.class.getName()).setDirectUrl("127.0.0.1:12299").setTimeout(500).setRegister(true).setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT).setApplication(new ApplicationConfig().setAppName(APP_NAME2));
    FaultToleranceModule module = (FaultToleranceModule) ExtensionLoaderFactory.getExtensionLoader(Module.class).getExtension("fault-tolerance");
    module.getRegulator().init();
}
Also used : ServerConfig(com.alipay.sofa.rpc.config.ServerConfig) FaultHelloService2(com.alipay.sofa.rpc.client.aft.bean.FaultHelloService2) ApplicationConfig(com.alipay.sofa.rpc.config.ApplicationConfig) ProviderConfig(com.alipay.sofa.rpc.config.ProviderConfig) FaultToleranceModule(com.alipay.sofa.rpc.module.FaultToleranceModule) FaultHelloService(com.alipay.sofa.rpc.client.aft.bean.FaultHelloService) HelloServiceTimeOutImpl(com.alipay.sofa.rpc.client.aft.bean.HelloServiceTimeOutImpl) Before(org.junit.Before)

Aggregations

FaultHelloService (com.alipay.sofa.rpc.client.aft.bean.FaultHelloService)1 FaultHelloService2 (com.alipay.sofa.rpc.client.aft.bean.FaultHelloService2)1 HelloServiceTimeOutImpl (com.alipay.sofa.rpc.client.aft.bean.HelloServiceTimeOutImpl)1 ApplicationConfig (com.alipay.sofa.rpc.config.ApplicationConfig)1 ProviderConfig (com.alipay.sofa.rpc.config.ProviderConfig)1 ServerConfig (com.alipay.sofa.rpc.config.ServerConfig)1 FaultToleranceModule (com.alipay.sofa.rpc.module.FaultToleranceModule)1 Before (org.junit.Before)1