Search in sources :

Example 1 with RaftApiMessageHandlerService

use of io.zeebe.broker.clustering.raft.RaftApiMessageHandlerService in project zeebe by zeebe-io.

the class TransportComponent method init.

@Override
public void init(SystemContext context) {
    final TransportComponentCfg transportComponentCfg = context.getConfigurationManager().readEntry("network", TransportComponentCfg.class);
    final ServiceContainer serviceContainer = context.getServiceContainer();
    final ActorFuture<Void> replactionApiFuture = bindNonBufferingProtocolEndpoint(serviceContainer, REPLICATION_API_SERVER_NAME, transportComponentCfg.replicationApi, transportComponentCfg, REPLICATION_API_MESSAGE_HANDLER, REPLICATION_API_MESSAGE_HANDLER);
    final ActorFuture<Void> managementApiFuture = bindBufferingProtocolEndpoint(serviceContainer, MANAGEMENT_API_SERVER_NAME, transportComponentCfg.managementApi, transportComponentCfg);
    final ActorFuture<Void> clientApiFuture = bindNonBufferingProtocolEndpoint(serviceContainer, CLIENT_API_SERVER_NAME, transportComponentCfg.clientApi, transportComponentCfg, CLIENT_API_MESSAGE_HANDLER, CLIENT_API_MESSAGE_HANDLER);
    final SocketAddress managementEndpoint = transportComponentCfg.managementApi.toSocketAddress(transportComponentCfg.host);
    final ActorFuture<Void> managementClientFuture = createClientTransport(serviceContainer, MANAGEMENT_API_CLIENT_NAME, transportComponentCfg.managementApi.getReceiveBufferSize(transportComponentCfg.defaultReceiveBufferSize), MGMT_REQUEST_POOL_SIZE, true, Collections.singletonList(managementEndpoint));
    final ActorFuture<Void> replicationClientFuture = createClientTransport(serviceContainer, REPLICATION_API_CLIENT_NAME, transportComponentCfg.replicationApi.getReceiveBufferSize(transportComponentCfg.defaultReceiveBufferSize), MGMT_REQUEST_POOL_SIZE, false, null);
    final ServiceName<Dispatcher> controlMessageBufferService = createReceiveBuffer(serviceContainer, CLIENT_API_SERVER_NAME, transportComponentCfg.clientApi.getReceiveBufferSize(transportComponentCfg.defaultReceiveBufferSize));
    final ClientApiMessageHandlerService messageHandlerService = new ClientApiMessageHandlerService();
    serviceContainer.createService(CLIENT_API_MESSAGE_HANDLER, messageHandlerService).dependency(controlMessageBufferService, messageHandlerService.getControlMessageBufferInjector()).groupReference(LogStreamServiceNames.WORKFLOW_STREAM_GROUP, messageHandlerService.getLogStreamsGroupReference()).groupReference(LogStreamServiceNames.SYSTEM_STREAM_GROUP, messageHandlerService.getLogStreamsGroupReference()).install();
    final RaftApiMessageHandlerService raftApiMessageHandlerService = new RaftApiMessageHandlerService();
    serviceContainer.createService(REPLICATION_API_MESSAGE_HANDLER, raftApiMessageHandlerService).groupReference(ClusterServiceNames.RAFT_SERVICE_GROUP, raftApiMessageHandlerService.getRaftGroupReference()).install();
    final long controlMessageRequestTimeoutInMillis = transportComponentCfg.clientApi.getControlMessageRequestTimeoutInMillis(Long.MAX_VALUE);
    final ControlMessageHandlerManagerService controlMessageHandlerManagerService = new ControlMessageHandlerManagerService(controlMessageRequestTimeoutInMillis);
    final ActorFuture<Void> controlMessageServiceFuture = serviceContainer.createService(TransportServiceNames.CONTROL_MESSAGE_HANDLER_MANAGER, controlMessageHandlerManagerService).dependency(controlMessageBufferService, controlMessageHandlerManagerService.getControlMessageBufferInjector()).dependency(TransportServiceNames.serverTransport(CLIENT_API_SERVER_NAME), controlMessageHandlerManagerService.getTransportInjector()).dependency(TaskQueueServiceNames.TASK_QUEUE_SUBSCRIPTION_MANAGER, controlMessageHandlerManagerService.getTaskSubscriptionManagerInjector()).dependency(TopicSubscriptionServiceNames.TOPIC_SUBSCRIPTION_SERVICE, controlMessageHandlerManagerService.getTopicSubscriptionServiceInjector()).dependency(SystemServiceNames.SYSTEM_LOG_MANAGER, controlMessageHandlerManagerService.getSystemPartitionManagerInjector()).dependency(ClusterServiceNames.CLUSTER_MANAGER_SERVICE, controlMessageHandlerManagerService.getClusterManagerInjector()).install();
    context.addRequiredStartAction(replactionApiFuture);
    context.addRequiredStartAction(managementApiFuture);
    context.addRequiredStartAction(clientApiFuture);
    context.addRequiredStartAction(managementClientFuture);
    context.addRequiredStartAction(replicationClientFuture);
    context.addRequiredStartAction(controlMessageServiceFuture);
}
Also used : TransportComponentCfg(io.zeebe.broker.transport.cfg.TransportComponentCfg) ServiceContainer(io.zeebe.servicecontainer.ServiceContainer) RaftApiMessageHandlerService(io.zeebe.broker.clustering.raft.RaftApiMessageHandlerService) ControlMessageHandlerManagerService(io.zeebe.broker.transport.controlmessage.ControlMessageHandlerManagerService) InetSocketAddress(java.net.InetSocketAddress) ClientApiMessageHandlerService(io.zeebe.broker.transport.clientapi.ClientApiMessageHandlerService)

Aggregations

RaftApiMessageHandlerService (io.zeebe.broker.clustering.raft.RaftApiMessageHandlerService)1 TransportComponentCfg (io.zeebe.broker.transport.cfg.TransportComponentCfg)1 ClientApiMessageHandlerService (io.zeebe.broker.transport.clientapi.ClientApiMessageHandlerService)1 ControlMessageHandlerManagerService (io.zeebe.broker.transport.controlmessage.ControlMessageHandlerManagerService)1 ServiceContainer (io.zeebe.servicecontainer.ServiceContainer)1 InetSocketAddress (java.net.InetSocketAddress)1