use of io.zeebe.broker.logstreams.processor.StreamProcessorService in project zeebe by zeebe-io.
the class TaskSubscriptionManager method createStreamProcessorService.
protected ActorFuture<Void> createStreamProcessorService(final LockTaskStreamProcessor factory, DirectBuffer newTaskTypeBuffer, final LogStreamBucket logStreamBucket, final DirectBuffer taskType) {
final TypedStreamEnvironment env = new TypedStreamEnvironment(logStreamBucket.getLogStream(), transport.getOutput());
final TypedStreamProcessor streamProcessor = factory.createStreamProcessor(env);
final ServiceName<LogStream> logStreamServiceName = logStreamBucket.getLogServiceName();
final String logName = logStreamBucket.getLogStream().getLogName();
final ServiceName<StreamProcessorController> streamProcessorServiceName = taskQueueLockStreamProcessorServiceName(logName, bufferAsString(taskType));
final String streamProcessorName = streamProcessorServiceName.getName();
final StreamProcessorService streamProcessorService = new StreamProcessorService(streamProcessorName, TASK_LOCK_STREAM_PROCESSOR_ID, streamProcessor).eventFilter(streamProcessor.buildTypeFilter());
return serviceContext.createService(streamProcessorServiceName, streamProcessorService).dependency(logStreamServiceName, streamProcessorService.getLogStreamInjector()).dependency(SNAPSHOT_STORAGE_SERVICE, streamProcessorService.getSnapshotStorageInjector()).install();
}
use of io.zeebe.broker.logstreams.processor.StreamProcessorService in project zeebe by zeebe-io.
the class TaskQueueManagerService method startTaskQueue.
@Override
public void startTaskQueue(ServiceName<LogStream> logStreamServiceName, final LogStream stream) {
final ServiceName<StreamProcessorController> streamProcessorServiceName = taskQueueInstanceStreamProcessorServiceName(stream.getLogName());
final String streamProcessorName = streamProcessorServiceName.getName();
final ServerTransport serverTransport = clientApiTransportInjector.getValue();
final TaskSubscriptionManager taskSubscriptionManager = taskSubscriptionManagerInjector.getValue();
final TaskInstanceStreamProcessor taskInstanceStreamProcessor = new TaskInstanceStreamProcessor(taskSubscriptionManager);
final TypedStreamEnvironment env = new TypedStreamEnvironment(stream, serverTransport.getOutput());
final TypedStreamProcessor streamProcessor = taskInstanceStreamProcessor.createStreamProcessor(env);
final StreamProcessorService taskInstanceStreamProcessorService = new StreamProcessorService(streamProcessorName, TASK_QUEUE_STREAM_PROCESSOR_ID, streamProcessor).eventFilter(streamProcessor.buildTypeFilter());
serviceContext.createService(streamProcessorServiceName, taskInstanceStreamProcessorService).group(TASK_QUEUE_STREAM_PROCESSOR_SERVICE_GROUP_NAME).dependency(logStreamServiceName, taskInstanceStreamProcessorService.getLogStreamInjector()).dependency(SNAPSHOT_STORAGE_SERVICE, taskInstanceStreamProcessorService.getSnapshotStorageInjector()).install();
startExpireLockService(logStreamServiceName, stream, env);
}
use of io.zeebe.broker.logstreams.processor.StreamProcessorService in project zeebe by zeebe-io.
the class WorkflowQueueManagerService method installIncidentStreamProcessor.
private void installIncidentStreamProcessor(final LogStream logStream) {
final ServiceName<StreamProcessorController> streamProcessorServiceName = incidentStreamProcessorServiceName(logStream.getLogName());
final String streamProcessorName = streamProcessorServiceName.getName();
final ServerTransport transport = clientApiTransportInjector.getValue();
final ServiceName<LogStream> logStreamServiceName = logStreamServiceName(logStream.getLogName());
final TypedStreamEnvironment env = new TypedStreamEnvironment(logStream, transport.getOutput());
final IncidentStreamProcessor incidentProcessorFactory = new IncidentStreamProcessor();
final TypedStreamProcessor streamProcessor = incidentProcessorFactory.createStreamProcessor(env);
final StreamProcessorService incidentStreamProcessorService = new StreamProcessorService(streamProcessorName, INCIDENT_PROCESSOR_ID, streamProcessor).eventFilter(streamProcessor.buildTypeFilter());
serviceContext.createService(streamProcessorServiceName, incidentStreamProcessorService).dependency(logStreamServiceName, incidentStreamProcessorService.getLogStreamInjector()).dependency(SNAPSHOT_STORAGE_SERVICE, incidentStreamProcessorService.getSnapshotStorageInjector()).install();
}
use of io.zeebe.broker.logstreams.processor.StreamProcessorService in project zeebe by zeebe-io.
the class WorkflowQueueManagerService method installWorkflowStreamProcessor.
private void installWorkflowStreamProcessor(final LogStream logStream) {
final ServiceName<StreamProcessorController> streamProcessorServiceName = workflowInstanceStreamProcessorServiceName(logStream.getLogName());
final String streamProcessorName = streamProcessorServiceName.getName();
final ServerTransport transport = clientApiTransportInjector.getValue();
final CommandResponseWriter responseWriter = new CommandResponseWriter(transport.getOutput());
final ServiceName<LogStream> logStreamServiceName = logStreamServiceName(logStream.getLogName());
final ServerTransport managementServer = managementServerInjector.getValue();
final CreateWorkflowResponseSender createWorkflowResponseSender = new CreateWorkflowResponseSender(managementServer);
final WorkflowInstanceStreamProcessor workflowInstanceStreamProcessor = new WorkflowInstanceStreamProcessor(responseWriter, createWorkflowResponseSender, workflowCfg.deploymentCacheSize, workflowCfg.payloadCacheSize);
final StreamProcessorService workflowStreamProcessorService = new StreamProcessorService(streamProcessorName, StreamProcessorIds.WORKFLOW_INSTANCE_PROCESSOR_ID, workflowInstanceStreamProcessor).eventFilter(WorkflowInstanceStreamProcessor.eventFilter());
serviceContext.createService(streamProcessorServiceName, workflowStreamProcessorService).dependency(logStreamServiceName, workflowStreamProcessorService.getLogStreamInjector()).dependency(SNAPSHOT_STORAGE_SERVICE, workflowStreamProcessorService.getSnapshotStorageInjector()).install();
}
use of io.zeebe.broker.logstreams.processor.StreamProcessorService in project zeebe by zeebe-io.
the class TaskQueueManagerService method startExpireLockService.
protected void startExpireLockService(ServiceName<LogStream> logStreamServiceName, LogStream stream, TypedStreamEnvironment env) {
final ServiceName<StreamProcessorController> expireLockStreamProcessorServiceName = taskQueueExpireLockStreamProcessorServiceName(stream.getLogName());
final TaskExpireLockStreamProcessor expireLockStreamProcessor = new TaskExpireLockStreamProcessor(env.buildStreamReader(), env.buildStreamWriter());
final TypedStreamProcessor streamProcessor = expireLockStreamProcessor.createStreamProcessor(env);
final StreamProcessorService expireLockStreamProcessorService = new StreamProcessorService(expireLockStreamProcessorServiceName.getName(), TASK_EXPIRE_LOCK_STREAM_PROCESSOR_ID, streamProcessor).eventFilter(streamProcessor.buildTypeFilter());
serviceContext.createService(expireLockStreamProcessorServiceName, expireLockStreamProcessorService).dependency(logStreamServiceName, expireLockStreamProcessorService.getLogStreamInjector()).dependency(SNAPSHOT_STORAGE_SERVICE, expireLockStreamProcessorService.getSnapshotStorageInjector()).install();
}
Aggregations