public WorkflowRepository( ServerTransport clientApiTransport, ControlMessageHandlerManager controlMessageHandlerManager, ServiceStartContext startContext, WorkflowState workflowState, ServiceName<Partition> partitionServiceName) { this.startContext = startContext; this.workflowState = workflowState; this.partitionServiceName = partitionServiceName; getWorkflowMessageHandler = new GetWorkflowControlMessageHandler(clientApiTransport.getOutput()); listWorkflowsControlMessageHandler = new ListWorkflowsControlMessageHandler(clientApiTransport.getOutput()); controlMessageHandlerManager.registerHandler(getWorkflowMessageHandler); controlMessageHandlerManager.registerHandler(listWorkflowsControlMessageHandler); }
public WorkflowRepository( ServerTransport clientApiTransport, ControlMessageHandlerManager controlMessageHandlerManager, ServiceStartContext startContext, WorkflowState workflowState, ServiceName<Partition> partitionServiceName) { this.startContext = startContext; this.workflowState = workflowState; this.partitionServiceName = partitionServiceName; getWorkflowMessageHandler = new GetWorkflowControlMessageHandler(clientApiTransport.getOutput()); listWorkflowsControlMessageHandler = new ListWorkflowsControlMessageHandler(clientApiTransport.getOutput()); controlMessageHandlerManager.registerHandler(getWorkflowMessageHandler); controlMessageHandlerManager.registerHandler(listWorkflowsControlMessageHandler); }
@Override public void start(ServiceStartContext context) { final Dispatcher controlMessageBuffer = controlMessageBufferInjector.getValue(); final ServerTransport transport = transportInjector.getValue(); final ActorScheduler actorScheduler = context.getScheduler(); final TopologyManager topologyManager = topologyManagerInjector.getValue(); final ServerOutput output = transport.getOutput(); final List<ControlMessageHandler> controlMessageHandlers = Collections.singletonList(new RequestTopologyHandler(output, topologyManager)); service = new ControlMessageHandlerManager( transport.getOutput(), controlMessageBuffer, actorScheduler, controlMessageHandlers); context.async(service.openAsync()); }
private void responseTo(GossipEvent event, long requestId, int streamId) { serverResponse.reset().writer(event).requestId(requestId).remoteStreamId(streamId); try { serverTransport.getOutput().sendResponse(serverResponse); } catch (Throwable t) { Loggers.GOSSIP_LOGGER.error("Error on sending response.", t); // ignore } }
private void responseTo(GossipEvent event, long requestId, int streamId) { serverResponse.reset().writer(event).requestId(requestId).remoteStreamId(streamId); try { serverTransport.getOutput().sendResponse(serverResponse); } catch (Throwable t) { Loggers.GOSSIP_LOGGER.error("Error on sending response.", t); // ignore } }
@Override public void start(ServiceStartContext context) { final Dispatcher controlMessageBuffer = controlMessageBufferInjector.getValue(); final ServerTransport transport = transportInjector.getValue(); final ActorScheduler actorScheduler = context.getScheduler(); final TopologyManager topologyManager = topologyManagerInjector.getValue(); final ServerOutput output = transport.getOutput(); final List<ControlMessageHandler> controlMessageHandlers = Collections.singletonList(new RequestTopologyHandler(output, topologyManager)); service = new ControlMessageHandlerManager( transport.getOutput(), controlMessageBuffer, actorScheduler, controlMessageHandlers); context.async(service.openAsync()); }
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(); }
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(); }