public void interruptClientConnections() { getService(TransportServiceNames.serverTransport(TransportServiceNames.CLIENT_API_SERVER_NAME)) .interruptAllChannels(); }
protected ActorFuture<ClientTransport> createClientTransport( final ServiceContainer serviceContainer, final String name, final ByteValue sendBufferSize, final Collection<IntTuple<SocketAddress>> defaultEndpoints) { final ClientTransportService service = new ClientTransportService(name, defaultEndpoints, sendBufferSize); return serviceContainer .createService(TransportServiceNames.clientTransport(name), service) .install(); } }
protected ServiceName<Dispatcher> createReceiveBuffer( final ServiceContainer serviceContainer, final String transportName, final ByteValue bufferSize) { final ServiceName<Dispatcher> serviceName = TransportServiceNames.receiveBufferName(transportName); createDispatcher(serviceContainer, serviceName, bufferSize); return serviceName; }
.createService(ZB_STREAM_PROCESSOR_SERVICE_NAME, streamProcessorService) .dependency( serverTransport(CLIENT_API_SERVER_NAME), streamProcessorService.getClientApiTransportInjector()) .dependency( .dependency(TOPOLOGY_MANAGER_SERVICE, streamProcessorService.getTopologyManagerInjector()) .dependency( clientTransport(MANAGEMENT_API_CLIENT_NAME), streamProcessorService.getManagementApiClientInjector()) .dependency( clientTransport(SUBSCRIPTION_API_CLIENT_NAME), streamProcessorService.getSubscriptionApiClientInjector()) .dependency(
private void initGossip( final CompositeServiceBuilder baseLayerInstall, final SystemContext context, final NodeInfo localMember) { final GossipService gossipService = new GossipService(context.getBrokerConfiguration()); baseLayerInstall .createService(GOSSIP_SERVICE, gossipService) .dependency( TransportServiceNames.clientTransport(TransportServiceNames.MANAGEMENT_API_CLIENT_NAME), gossipService.getClientTransportInjector()) .dependency( TransportServiceNames.bufferingServerTransport( TransportServiceNames.MANAGEMENT_API_SERVER_NAME), gossipService.getBufferingServerTransportInjector()) .install(); // TODO: decide whether failure to join gossip cluster should result in broker startup fail final GossipJoinService gossipJoinService = new GossipJoinService(context.getBrokerConfiguration().getCluster(), localMember); baseLayerInstall .createService(GOSSIP_JOIN_SERVICE, gossipJoinService) .dependency(GOSSIP_SERVICE, gossipJoinService.getGossipInjector()) .install(); }
@Override public void init(final SystemContext context) { final ServiceContainer serviceContainer = context.getServiceContainer(); final SubscriptionApiCommandMessageHandlerService messageHandlerService = new SubscriptionApiCommandMessageHandlerService(); serviceContainer .createService(SUBSCRIPTION_API_MESSAGE_HANDLER_SERVICE_NAME, messageHandlerService) .dependency( bufferingServerTransport(SUBSCRIPTION_API_SERVER_NAME), messageHandlerService.getServerTransportInjector()) .groupReference( LEADER_PARTITION_GROUP_NAME, messageHandlerService.getLeaderParitionsGroupReference()) .install(); } }
.createService(ZB_STREAM_PROCESSOR_SERVICE_NAME, streamProcessorService) .dependency( serverTransport(CLIENT_API_SERVER_NAME), streamProcessorService.getClientApiTransportInjector()) .dependency( .dependency(TOPOLOGY_MANAGER_SERVICE, streamProcessorService.getTopologyManagerInjector()) .dependency( clientTransport(MANAGEMENT_API_CLIENT_NAME), streamProcessorService.getManagementApiClientInjector()) .dependency( clientTransport(SUBSCRIPTION_API_CLIENT_NAME), streamProcessorService.getSubscriptionApiClientInjector()) .dependency(
private void initGossip( final CompositeServiceBuilder baseLayerInstall, final SystemContext context, final NodeInfo localMember) { final GossipService gossipService = new GossipService(context.getBrokerConfiguration()); baseLayerInstall .createService(GOSSIP_SERVICE, gossipService) .dependency( TransportServiceNames.clientTransport(TransportServiceNames.MANAGEMENT_API_CLIENT_NAME), gossipService.getClientTransportInjector()) .dependency( TransportServiceNames.bufferingServerTransport( TransportServiceNames.MANAGEMENT_API_SERVER_NAME), gossipService.getBufferingServerTransportInjector()) .install(); // TODO: decide whether failure to join gossip cluster should result in broker startup fail final GossipJoinService gossipJoinService = new GossipJoinService(context.getBrokerConfiguration().getCluster(), localMember); baseLayerInstall .createService(GOSSIP_JOIN_SERVICE, gossipJoinService) .dependency(GOSSIP_SERVICE, gossipJoinService.getGossipInjector()) .install(); final AtomixService atomixService = new AtomixService(context.getBrokerConfiguration()); baseLayerInstall.createService(ATOMIX_SERVICE, atomixService).install(); }
@Override public void init(final SystemContext context) { final ServiceContainer serviceContainer = context.getServiceContainer(); final SubscriptionApiCommandMessageHandlerService messageHandlerService = new SubscriptionApiCommandMessageHandlerService(); serviceContainer .createService(SUBSCRIPTION_API_MESSAGE_HANDLER_SERVICE_NAME, messageHandlerService) .dependency( bufferingServerTransport(SUBSCRIPTION_API_SERVER_NAME), messageHandlerService.getServerTransportInjector()) .groupReference( LEADER_PARTITION_GROUP_NAME, messageHandlerService.getLeaderParitionsGroupReference()) .install(); } }
public void interruptClientConnections() { getService(TransportServiceNames.serverTransport(TransportServiceNames.CLIENT_API_SERVER_NAME)) .interruptAllChannels(); }
controlMessageHandlerManagerService.getControlMessageBufferInjector()) .dependency( TransportServiceNames.serverTransport(CLIENT_API_SERVER_NAME), controlMessageHandlerManagerService.getTransportInjector()) .dependency( controlMessageHandlerManagerService.getTopologyManagerInjector()) .dependency( TransportServiceNames.clientTransport(MANAGEMENT_API_CLIENT_NAME), controlMessageHandlerManagerService.getManagementClientTransportInjector()) .install();
protected ActorFuture<ClientTransport> createClientTransport( final ServiceContainer serviceContainer, final String name, final ByteValue sendBufferSize, final Collection<IntTuple<SocketAddress>> defaultEndpoints) { final ClientTransportService service = new ClientTransportService(name, defaultEndpoints, sendBufferSize); return serviceContainer .createService(TransportServiceNames.clientTransport(name), service) .install(); } }
protected ActorFuture<BufferingServerTransport> createBufferingServerTransport( final SystemContext systemContext, final ServiceContainer serviceContainer, final String name, final InetSocketAddress bindAddress, final ByteValue sendBufferSize, final ByteValue receiveBufferSize) { final ServiceName<Dispatcher> receiveBufferName = createReceiveBuffer(serviceContainer, name, receiveBufferSize); final BufferingServerTransportService service = new BufferingServerTransportService(name, bindAddress, sendBufferSize); systemContext.addResourceReleasingDelegate(service.getReleasingResourcesDelegate()); return serviceContainer .createService(TransportServiceNames.bufferingServerTransport(name), service) .dependency(receiveBufferName, service.getReceiveBufferInjector()) .install(); }
protected ServiceName<Dispatcher> createReceiveBuffer( final ServiceContainer serviceContainer, final String transportName, final ByteValue bufferSize) { final ServiceName<Dispatcher> serviceName = TransportServiceNames.receiveBufferName(transportName); createDispatcher(serviceContainer, serviceName, bufferSize); return serviceName; }
public void startBroker() { startTime = System.currentTimeMillis(); broker = new Broker(brokerCfg, newTemporaryFolder.getAbsolutePath(), controlledActorClock); final ServiceContainer serviceContainer = broker.getBrokerContext().getServiceContainer(); try { // Hack: block until the system stream processor is available // this is required in the broker-test suite, because the client rule does not perform request // retries // How to make it better: https://github.com/zeebe-io/zeebe/issues/196 final String partitionName = Partition.getPartitionName(Protocol.DEPLOYMENT_PARTITION); serviceContainer .createService(TestService.NAME, new TestService()) .dependency(ClusterBaseLayerServiceNames.leaderPartitionServiceName(partitionName)) .dependency( TransportServiceNames.serverTransport(TransportServiceNames.CLIENT_API_SERVER_NAME)) .dependency(WORKFLOW_REPOSITORY_SERVICE) .install() .get(timeout, TimeUnit.SECONDS); } catch (final InterruptedException | ExecutionException | TimeoutException e) { stopBroker(); throw new RuntimeException( String.format( "System partition not installed into the container withing %d seconds.", timeout), e); } dataDirectories = broker.getBrokerContext().getBrokerConfiguration().getData().getDirectories(); }
controlMessageHandlerManagerService.getControlMessageBufferInjector()) .dependency( TransportServiceNames.serverTransport(CLIENT_API_SERVER_NAME), controlMessageHandlerManagerService.getTransportInjector()) .dependency( controlMessageHandlerManagerService.getTopologyManagerInjector()) .dependency( TransportServiceNames.clientTransport(MANAGEMENT_API_CLIENT_NAME), controlMessageHandlerManagerService.getManagementClientTransportInjector()) .install();
private void installPartition( final ServiceStartContext startContext, final RaftPersistentConfiguration configuration) { final String partitionName = Partition.getPartitionName(configuration.getPartitionId()); final ServiceName<Void> partitionInstallServiceName = partitionInstallServiceName(partitionName); final PartitionInstallService partitionInstallService = new PartitionInstallService(brokerCfg, configuration); startContext .createService(partitionInstallServiceName, partitionInstallService) .dependency( clientTransport(REPLICATION_API_CLIENT_NAME), partitionInstallService.getClientTransportInjector()) .install(); }
protected ActorFuture<BufferingServerTransport> createBufferingServerTransport( final SystemContext systemContext, final ServiceContainer serviceContainer, final String name, final InetSocketAddress bindAddress, final ByteValue sendBufferSize, final ByteValue receiveBufferSize) { final ServiceName<Dispatcher> receiveBufferName = createReceiveBuffer(serviceContainer, name, receiveBufferSize); final BufferingServerTransportService service = new BufferingServerTransportService(name, bindAddress, sendBufferSize); systemContext.addResourceReleasingDelegate(service.getReleasingResourcesDelegate()); return serviceContainer .createService(TransportServiceNames.bufferingServerTransport(name), service) .dependency(receiveBufferName, service.getReceiveBufferInjector()) .install(); }
public void startBroker() { startTime = System.currentTimeMillis(); broker = new Broker(brokerCfg, newTemporaryFolder.getAbsolutePath(), controlledActorClock); final ServiceContainer serviceContainer = broker.getBrokerContext().getServiceContainer(); try { // Hack: block until the system stream processor is available // this is required in the broker-test suite, because the client rule does not perform request // retries // How to make it better: https://github.com/zeebe-io/zeebe/issues/196 final String partitionName = Partition.getPartitionName(Protocol.DEPLOYMENT_PARTITION); serviceContainer .createService(TestService.NAME, new TestService()) .dependency(ClusterBaseLayerServiceNames.leaderPartitionServiceName(partitionName)) .dependency( TransportServiceNames.serverTransport(TransportServiceNames.CLIENT_API_SERVER_NAME)) .dependency(WORKFLOW_REPOSITORY_SERVICE) .install() .get(timeout, TimeUnit.SECONDS); } catch (final InterruptedException | ExecutionException | TimeoutException e) { stopBroker(); throw new RuntimeException( String.format( "System partition not installed into the container withing %d seconds.", timeout), e); } dataDirectories = broker.getBrokerContext().getBrokerConfiguration().getData().getDirectories(); }
private void installPartition( final ServiceStartContext startContext, final RaftPersistentConfiguration configuration) { final String partitionName = Partition.getPartitionName(configuration.getPartitionId()); final ServiceName<Void> partitionInstallServiceName = partitionInstallServiceName(partitionName); final PartitionInstallService partitionInstallService = new PartitionInstallService(brokerCfg, configuration); startContext .createService(partitionInstallServiceName, partitionInstallService) .dependency( clientTransport(REPLICATION_API_CLIENT_NAME), partitionInstallService.getClientTransportInjector()) .install(); }