Search in sources :

Example 1 with GreetingsService

use of com.pinpoint.test.plugin.api.GreetingsService in project pinpoint by naver.

the class DubboConsumerPluginTestController method sayHi.

@RequestMapping(value = "/sayHi", method = RequestMethod.GET)
@ResponseBody
public String sayHi() {
    ReferenceConfig<GreetingsService> reference = new ReferenceConfig<>();
    reference.setInterface(GreetingsService.class);
    reference.setGeneric("true");
    DubboBootstrap bootstrap = DubboBootstrap.getInstance();
    bootstrap.application(new ApplicationConfig("dubbo-demo-api-consumer")).registry(new RegistryConfig("zookeeper://" + ZOOKEEPER_HOST + ":2181")).reference(reference).start();
    GreetingsService demoService = ReferenceConfigCache.getCache().get(reference);
    String message = demoService.sayHi("dubbo");
    return message;
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) ReferenceConfig(org.apache.dubbo.config.ReferenceConfig) GreetingsService(com.pinpoint.test.plugin.api.GreetingsService) DubboBootstrap(org.apache.dubbo.config.bootstrap.DubboBootstrap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

GreetingsService (com.pinpoint.test.plugin.api.GreetingsService)1 ApplicationConfig (org.apache.dubbo.config.ApplicationConfig)1 ReferenceConfig (org.apache.dubbo.config.ReferenceConfig)1 RegistryConfig (org.apache.dubbo.config.RegistryConfig)1 DubboBootstrap (org.apache.dubbo.config.bootstrap.DubboBootstrap)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1