com.xxl.rpc.remoting.provider.XxlRpcProviderFactory Java Examples

The following examples show how to use com.xxl.rpc.remoting.provider.XxlRpcProviderFactory. 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: XxlJobExecutor.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
private void initRpcProvider(String ip, int port, String appName, String accessToken) throws Exception {

        // init, provider factory
        String address = IpUtil.getIpPort(ip, port);
        Map<String, String> serviceRegistryParam = new HashMap<String, String>();
        serviceRegistryParam.put("appName", appName);
        serviceRegistryParam.put("address", address);

        xxlRpcProviderFactory = new XxlRpcProviderFactory();
        xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);

        // add services
        xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());

        // start
        xxlRpcProviderFactory.start();

    }
 
Example #2
Source File: XxlJobDynamicScheduler.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
private void initRpcProvider(){
    // init
    XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(
            NetEnum.JETTY,
            Serializer.SerializeEnum.HESSIAN.getSerializer(),
            null,
            0,
            XxlJobAdminConfig.getAdminConfig().getAccessToken(),
            null,
            null);

    // add services
    xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());

    // jetty handler
    jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
}
 
Example #3
Source File: XxlJobExecutor.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
private void initRpcProvider(String ip, int port, String appName, String accessToken, long registryLazy) throws Exception {
    // init invoker factory
    xxlRpcInvokerFactory = new XxlRpcInvokerFactory();

    // init, provider factory
    String address = IpUtil.getIpPort(ip, port);
    Map<String, String> serviceRegistryParam = new HashMap<String, String>();
    serviceRegistryParam.put("appName", appName);
    serviceRegistryParam.put("address", address);
    serviceRegistryParam.put("registryLazy", String.valueOf(registryLazy));

    xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);

    // add services
    xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());

    // start
    xxlRpcProviderFactory.start();

}
 
Example #4
Source File: XxlJobExecutor.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
private void initRpcProvider(String ip, int port, String appName, String accessToken, long registryLazy) throws Exception {
    // init invoker factory
    xxlRpcInvokerFactory = new XxlRpcInvokerFactory();

    // init, provider factory
    String address = IpUtil.getIpPort(ip, port);
    Map<String, String> serviceRegistryParam = new HashMap<String, String>();
    serviceRegistryParam.put("appName", appName);
    serviceRegistryParam.put("address", address);
    serviceRegistryParam.put("registryLazy", String.valueOf(registryLazy));

    xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);

    // add services
    xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());

    // start
    xxlRpcProviderFactory.start();

}
 
Example #5
Source File: XxlMqBrokerImpl.java    From xxl-mq with GNU General Public License v3.0 6 votes vote down vote up
public void initServer() throws Exception {

        // address, static registry
        ip = (ip!=null&&ip.trim().length()>0)?ip:IpUtil.getIp();
        String address = IpUtil.getIpPort(ip, port);

        XxlCommonRegistryData xxlCommonRegistryData = new XxlCommonRegistryData();
        xxlCommonRegistryData.setKey(IXxlMqBroker.class.getName());
        xxlCommonRegistryData.setValue(address);
        XxlCommonRegistryServiceImpl.staticRegistryData = xxlCommonRegistryData;


        // init server
        providerFactory = new XxlRpcProviderFactory();
        providerFactory.initConfig(NetEnum.NETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, null, null, null);

        // add server
        providerFactory.addService(IXxlMqBroker.class.getName(), null, this);

        // start server
        providerFactory.start();
    }
 
Example #6
Source File: XxlJobDynamicScheduler.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
private void initRpcProvider() {
    // init
    XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), null, 0, XxlJobAdminConfig.getAdminConfig().getAccessToken(), null, null);

    // add services
    xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());

    // jetty handler
    jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
}
 
Example #7
Source File: XxlJobDynamicScheduler.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
private void initRpcProvider() {
    // init
    XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), null, 0, XxlJobAdminConfig.getAdminConfig().getAccessToken(), null, null);

    // add services
    xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());

    // jetty handler
    jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
}