Search in sources :

Example 1 with PbParamService

use of com.weibo.motan.demo.service.PbParamService in project motan by weibocom.

the class Motan2RpcClient method main.

public static void main(String[] args) throws Throwable {
    ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "classpath:motan2_demo_client.xml" });
    MotanDemoService service;
    // hessian
    service = (MotanDemoService) ctx.getBean("motanDemoReferer");
    print(service);
    // simple serialization
    service = (MotanDemoService) ctx.getBean("motanDemoReferer-simple");
    print(service);
    // breeze serialization
    service = (MotanDemoService) ctx.getBean("motanDemoReferer-breeze");
    print(service);
    // pb serialization
    PbParamService pbService = (PbParamService) ctx.getBean("motanDemoReferer-pb");
    System.out.println(pbService.getFeature(Point.newBuilder().setLatitude(123).setLongitude(456).build()));
    // common client
    CommonHandler xmlClient = (CommonHandler) ctx.getBean("motanDemoReferer-common-client");
    motan2XmlCommonClientDemo(xmlClient);
    motan2ApiCommonClientDemo();
    System.out.println("motan demo is finish.");
    System.exit(0);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) MotanDemoService(com.weibo.motan.demo.service.MotanDemoService) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) CommonHandler(com.weibo.api.motan.proxy.CommonHandler) PbParamService(com.weibo.motan.demo.service.PbParamService)

Aggregations

CommonHandler (com.weibo.api.motan.proxy.CommonHandler)1 MotanDemoService (com.weibo.motan.demo.service.MotanDemoService)1 PbParamService (com.weibo.motan.demo.service.PbParamService)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1