Search in sources :

Example 1 with GRPCManagerService

use of org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService in project incubator-skywalking by apache.

the class RemoteModuleGRPCProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    String host = config.getProperty(HOST);
    Integer port = (Integer) config.get(PORT);
    GRPCManagerService managerService = getManager().find(GRPCManagerModule.NAME).getService(GRPCManagerService.class);
    GRPCServer gRPCServer = managerService.createIfAbsent(host, port);
    gRPCServer.addHandler(new RemoteCommonServiceHandler(remoteDataRegisterService));
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(RemoteModule.NAME, this.name(), new RemoteModuleGRPCRegistration(host, port));
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(remoteSenderService);
}
Also used : GRPCManagerService(org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService) GRPCServer(org.apache.skywalking.apm.collector.server.grpc.GRPCServer) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) RemoteCommonServiceHandler(org.apache.skywalking.apm.collector.remote.grpc.handler.RemoteCommonServiceHandler)

Example 2 with GRPCManagerService

use of org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService in project incubator-skywalking by apache.

the class AgentModuleGRPCProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    String host = config.getProperty(HOST);
    Integer port = (Integer) config.get(PORT);
    String sslCertChainFilePath = config.getProperty(SSL_CERT_CHAIN_FILEPATH);
    String sslPrivateKeyFilePath = config.getProperty(SSL_PRIVATE_KEY_FILE);
    AuthenticationSimpleChecker.INSTANCE.setExpectedToken(config.getProperty(AUTHENTICATION, ""));
    File sslCertChainFile = null;
    File sslPrivateKeyFile = null;
    if (StringUtil.isNotBlank(sslCertChainFilePath)) {
        sslCertChainFile = new File(sslCertChainFilePath);
        if (!(sslCertChainFile.exists() && sslCertChainFile.isFile())) {
            sslCertChainFile = null;
        }
    }
    if (StringUtil.isNotBlank(sslPrivateKeyFilePath)) {
        sslPrivateKeyFile = new File(sslPrivateKeyFilePath);
        if (!(sslPrivateKeyFile.exists() && sslPrivateKeyFile.isFile())) {
            sslPrivateKeyFile = null;
        }
    }
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(AgentGRPCModule.NAME, this.name(), new AgentModuleGRPCRegistration(host, port));
    AgentGRPCNamingListener namingListener = new AgentGRPCNamingListener();
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(namingListener);
    NamingHandlerRegisterService namingHandlerRegisterService = getManager().find(NamingModule.NAME).getService(NamingHandlerRegisterService.class);
    namingHandlerRegisterService.register(new AgentGRPCNamingHandler(namingListener));
    GRPCManagerService managerService = getManager().find(GRPCManagerModule.NAME).getService(GRPCManagerService.class);
    GRPCServer gRPCServer;
    if (sslCertChainFile != null && sslPrivateKeyFile != null) {
        gRPCServer = managerService.createIfAbsent(host, port, sslCertChainFile, sslPrivateKeyFile);
    } else {
        gRPCServer = managerService.createIfAbsent(host, port);
    }
    addHandlers(gRPCServer);
}
Also used : NamingHandlerRegisterService(org.apache.skywalking.apm.collector.naming.service.NamingHandlerRegisterService) GRPCManagerService(org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService) GRPCServer(org.apache.skywalking.apm.collector.server.grpc.GRPCServer) AgentGRPCNamingHandler(org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingHandler) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) AgentGRPCNamingListener(org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingListener) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) File(java.io.File)

Aggregations

ModuleListenerService (org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService)2 ModuleRegisterService (org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService)2 GRPCManagerService (org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService)2 GRPCServer (org.apache.skywalking.apm.collector.server.grpc.GRPCServer)2 File (java.io.File)1 AgentGRPCNamingHandler (org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingHandler)1 AgentGRPCNamingListener (org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingListener)1 NamingHandlerRegisterService (org.apache.skywalking.apm.collector.naming.service.NamingHandlerRegisterService)1 RemoteCommonServiceHandler (org.apache.skywalking.apm.collector.remote.grpc.handler.RemoteCommonServiceHandler)1