public TypedStreamProcessor createTypedStreamProcessor( ServiceName<Partition> partitionServiceName, int partitionId, TypedStreamEnvironment streamEnvironment, ZeebeState zeebeState) { final TypedEventStreamProcessorBuilder typedProcessorBuilder = streamEnvironment.newStreamProcessor().keyGenerator(zeebeState.getKeyGenerator()); addDistributeDeploymentProcessors(zeebeState, streamEnvironment, typedProcessorBuilder); final BpmnStepProcessor stepProcessor = addWorkflowProcessors(zeebeState, typedProcessorBuilder); addDeploymentRelatedProcessorAndServices( partitionServiceName, partitionId, zeebeState, typedProcessorBuilder); addIncidentProcessors(zeebeState, stepProcessor, typedProcessorBuilder); addJobProcessors(zeebeState, typedProcessorBuilder); addMessageProcessors(zeebeState, typedProcessorBuilder); return typedProcessorBuilder.build(); }
public void startStreamProcessors( final ServiceName<Partition> partitionServiceName, final Partition partition) { final int partitionId = partition.getInfo().getPartitionId(); final Builder streamProcessorServiceBuilder = streamProcessorServiceFactory .createService(partition, partitionServiceName) .processorId(partitionId) .processorName(PROCESSOR_NAME); final StateStorage stateStorage = partition.getStateStorageFactory().create(partitionId, PROCESSOR_NAME); final StateSnapshotController stateSnapshotController = new StateSnapshotController(DefaultZeebeDbFactory.DEFAULT_DB_FACTORY, stateStorage); streamProcessorServiceBuilder .snapshotController(stateSnapshotController) .streamProcessorFactory( (zeebeDb) -> { final ZeebeState zeebeState = new ZeebeState(partitionId, zeebeDb); final TypedStreamEnvironment streamEnvironment = new TypedStreamEnvironment( partition.getLogStream(), clientApiTransport.getOutput()); return createTypedStreamProcessor( partitionServiceName, partitionId, streamEnvironment, zeebeState); }) .build(); }
private void addMessageProcessors( ZeebeState zeebeState, TypedEventStreamProcessorBuilder typedProcessorBuilder) { final SubscriptionCommandSender subscriptionCommandSender = new SubscriptionCommandSender(clusterCfg, getSubscriptionApiClientInjector().getValue()); MessageEventProcessors.addMessageProcessors( typedProcessorBuilder, zeebeState, subscriptionCommandSender, topologyManager); }
DurationUtil.parse(brokerConfiguration.getData().getSnapshotPeriod()); final StreamProcessorServiceFactory streamProcessorFactory = new StreamProcessorServiceFactory(serviceContainer, snapshotPeriod); serviceContainer .createService(STREAM_PROCESSOR_SERVICE_FACTORY, streamProcessorFactory) new ZbStreamProcessorService(brokerConfiguration.getCluster()); serviceContainer .createService(ZB_STREAM_PROCESSOR_SERVICE_NAME, streamProcessorService) .dependency( serverTransport(CLIENT_API_SERVER_NAME), streamProcessorService.getClientApiTransportInjector()) .dependency( TransportServiceNames.CONTROL_MESSAGE_HANDLER_MANAGER, streamProcessorService.getControlMessageHandlerManagerServiceInjector()) .dependency(TOPOLOGY_MANAGER_SERVICE, streamProcessorService.getTopologyManagerInjector()) .dependency( clientTransport(MANAGEMENT_API_CLIENT_NAME), streamProcessorService.getManagementApiClientInjector()) .dependency( clientTransport(SUBSCRIPTION_API_CLIENT_NAME), streamProcessorService.getSubscriptionApiClientInjector()) .dependency( STREAM_PROCESSOR_SERVICE_FACTORY, streamProcessorService.getStreamProcessorServiceFactoryInjector()) .groupReference( LEADER_PARTITION_GROUP_NAME, streamProcessorService.getPartitionsGroupReference()) .install();
new StateStorageFactoryService(configuration.getStatesDirectory()); stateStorageFactoryServiceName = stateStorageFactoryServiceName(logName); partitionInstall .createService(stateStorageFactoryServiceName, stateStorageFactoryService)
protected void start() { LOG.info("Version: {}", VERSION); LOG.info("Starting broker with configuration {}", getConfig().toJson()); brokerContext.addComponent(new SystemComponent()); brokerContext.addComponent(new TransportComponent()); brokerContext.addComponent(new LogStreamsComponent()); brokerContext.addComponent(new SubscriptionComponent()); brokerContext.addComponent(new ClusterComponent()); brokerContext.addComponent(new GatewayComponent()); brokerContext.addComponent(new ExporterComponent()); brokerContext.init(); }
public TypedStreamProcessor createTypedStreamProcessor( ServiceName<Partition> partitionServiceName, int partitionId, TypedStreamEnvironment streamEnvironment, ZeebeState zeebeState) { final TypedEventStreamProcessorBuilder typedProcessorBuilder = streamEnvironment.newStreamProcessor().keyGenerator(zeebeState.getKeyGenerator()); addDistributeDeploymentProcessors(zeebeState, streamEnvironment, typedProcessorBuilder); final BpmnStepProcessor stepProcessor = addWorkflowProcessors(zeebeState, typedProcessorBuilder); addDeploymentRelatedProcessorAndServices( partitionServiceName, partitionId, zeebeState, typedProcessorBuilder); addIncidentProcessors(zeebeState, stepProcessor, typedProcessorBuilder); addJobProcessors(zeebeState, typedProcessorBuilder); addMessageProcessors(zeebeState, typedProcessorBuilder); return typedProcessorBuilder.build(); }
public void startStreamProcessors( final ServiceName<Partition> partitionServiceName, final Partition partition) { final int partitionId = partition.getInfo().getPartitionId(); final Builder streamProcessorServiceBuilder = streamProcessorServiceFactory .createService(partition, partitionServiceName) .processorId(partitionId) .processorName(PROCESSOR_NAME); final StateStorage stateStorage = partition.getStateStorageFactory().create(partitionId, PROCESSOR_NAME); final StateSnapshotController stateSnapshotController = new StateSnapshotController(DefaultZeebeDbFactory.DEFAULT_DB_FACTORY, stateStorage); streamProcessorServiceBuilder .snapshotController(stateSnapshotController) .streamProcessorFactory( (zeebeDb) -> { final ZeebeState zeebeState = new ZeebeState(partitionId, zeebeDb); final TypedStreamEnvironment streamEnvironment = new TypedStreamEnvironment( partition.getLogStream(), clientApiTransport.getOutput()); return createTypedStreamProcessor( partitionServiceName, partitionId, streamEnvironment, zeebeState); }) .build(); }
DurationUtil.parse(brokerConfiguration.getData().getSnapshotPeriod()); final StreamProcessorServiceFactory streamProcessorFactory = new StreamProcessorServiceFactory(serviceContainer, snapshotPeriod); serviceContainer .createService(STREAM_PROCESSOR_SERVICE_FACTORY, streamProcessorFactory) new ZbStreamProcessorService(brokerConfiguration.getCluster()); serviceContainer .createService(ZB_STREAM_PROCESSOR_SERVICE_NAME, streamProcessorService) .dependency( serverTransport(CLIENT_API_SERVER_NAME), streamProcessorService.getClientApiTransportInjector()) .dependency( TransportServiceNames.CONTROL_MESSAGE_HANDLER_MANAGER, streamProcessorService.getControlMessageHandlerManagerServiceInjector()) .dependency(TOPOLOGY_MANAGER_SERVICE, streamProcessorService.getTopologyManagerInjector()) .dependency( clientTransport(MANAGEMENT_API_CLIENT_NAME), streamProcessorService.getManagementApiClientInjector()) .dependency( clientTransport(SUBSCRIPTION_API_CLIENT_NAME), streamProcessorService.getSubscriptionApiClientInjector()) .dependency( STREAM_PROCESSOR_SERVICE_FACTORY, streamProcessorService.getStreamProcessorServiceFactoryInjector()) .groupReference( LEADER_PARTITION_GROUP_NAME, streamProcessorService.getPartitionsGroupReference()) .install();
new StateStorageFactoryService(configuration.getStatesDirectory()); stateStorageFactoryServiceName = stateStorageFactoryServiceName(logName); partitionInstall .createService(stateStorageFactoryServiceName, stateStorageFactoryService)
private void addMessageProcessors( ZeebeState zeebeState, TypedEventStreamProcessorBuilder typedProcessorBuilder) { final SubscriptionCommandSender subscriptionCommandSender = new SubscriptionCommandSender(clusterCfg, getSubscriptionApiClientInjector().getValue()); MessageEventProcessors.addMessageProcessors( typedProcessorBuilder, zeebeState, subscriptionCommandSender, topologyManager); }
protected void start() { LOG.info("Version: {}", VERSION); LOG.info("Starting broker with configuration {}", getConfig().toJson()); brokerContext.addComponent(new SystemComponent()); brokerContext.addComponent(new TransportComponent()); brokerContext.addComponent(new LogStreamsComponent()); brokerContext.addComponent(new SubscriptionComponent()); brokerContext.addComponent(new ClusterComponent()); brokerContext.addComponent(new GatewayComponent()); brokerContext.addComponent(new ExporterComponent()); brokerContext.init(); }