Search in sources :

Example 1 with ZbColumnFamilies

use of io.camunda.zeebe.engine.state.ZbColumnFamilies in project zeebe-process-test by camunda.

the class EngineFactory method create.

public static ZeebeTestEngine create(final int port) {
    final int partitionId = 1;
    final int partitionCount = 1;
    final ControlledActorClock clock = createActorClock();
    final ActorScheduler scheduler = createAndStartActorScheduler(clock);
    final InMemoryLogStorage logStorage = new InMemoryLogStorage();
    final LogStream logStream = createLogStream(logStorage, scheduler, partitionId);
    final SubscriptionCommandSenderFactory subscriptionCommandSenderFactory = new SubscriptionCommandSenderFactory(logStream.newLogStreamRecordWriter().join(), partitionId);
    final GrpcToLogStreamGateway gateway = new GrpcToLogStreamGateway(logStream.newLogStreamRecordWriter().join(), partitionId, partitionCount, port);
    final Server grpcServer = ServerBuilder.forPort(port).addService(gateway).build();
    final GrpcResponseWriter grpcResponseWriter = new GrpcResponseWriter(gateway);
    final ZeebeDb<ZbColumnFamilies> zeebeDb = createDatabase();
    final EngineStateMonitor engineStateMonitor = new EngineStateMonitor(logStorage, logStream.newLogStreamReader().join());
    final StreamProcessor streamProcessor = createStreamProcessor(logStream, zeebeDb, scheduler, grpcResponseWriter, engineStateMonitor, partitionCount, subscriptionCommandSenderFactory);
    final LogStreamReader reader = logStream.newLogStreamReader().join();
    final RecordStreamSourceImpl recordStream = new RecordStreamSourceImpl(reader, partitionId);
    return new InMemoryEngine(grpcServer, streamProcessor, gateway, zeebeDb, logStream, scheduler, recordStream, clock, engineStateMonitor);
}
Also used : StreamProcessor(io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor) ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) Server(io.grpc.Server) LogStream(io.camunda.zeebe.logstreams.log.LogStream) ZbColumnFamilies(io.camunda.zeebe.engine.state.ZbColumnFamilies) ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) LogStreamReader(io.camunda.zeebe.logstreams.log.LogStreamReader)

Example 2 with ZbColumnFamilies

use of io.camunda.zeebe.engine.state.ZbColumnFamilies in project zeebe-process-test by camunda-cloud.

the class EngineFactory method create.

public static ZeebeTestEngine create(final int port) {
    final int partitionId = 1;
    final int partitionCount = 1;
    final ControlledActorClock clock = createActorClock();
    final ActorScheduler scheduler = createAndStartActorScheduler(clock);
    final InMemoryLogStorage logStorage = new InMemoryLogStorage();
    final LogStream logStream = createLogStream(logStorage, scheduler, partitionId);
    final SubscriptionCommandSenderFactory subscriptionCommandSenderFactory = new SubscriptionCommandSenderFactory(logStream.newLogStreamRecordWriter().join(), partitionId);
    final CommandWriter commandWriter = new CommandWriter(logStream.newLogStreamRecordWriter().join());
    final GatewayRequestStore gatewayRequestStore = new GatewayRequestStore();
    final GrpcToLogStreamGateway gateway = new GrpcToLogStreamGateway(commandWriter, partitionId, partitionCount, port, gatewayRequestStore);
    final Server grpcServer = ServerBuilder.forPort(port).addService(gateway).build();
    final GrpcResponseWriter grpcResponseWriter = new GrpcResponseWriter(gateway, gatewayRequestStore);
    final ZeebeDb<ZbColumnFamilies> zeebeDb = createDatabase();
    final StreamProcessor streamProcessor = createStreamProcessor(logStream, zeebeDb, scheduler, grpcResponseWriter, partitionCount, subscriptionCommandSenderFactory);
    final EngineStateMonitor engineStateMonitor = new EngineStateMonitor(logStorage, streamProcessor);
    final LogStreamReader reader = logStream.newLogStreamReader().join();
    final RecordStreamSourceImpl recordStream = new RecordStreamSourceImpl(reader, partitionId);
    return new InMemoryEngine(grpcServer, streamProcessor, gateway, zeebeDb, logStream, scheduler, recordStream, clock, engineStateMonitor);
}
Also used : StreamProcessor(io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor) ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) Server(io.grpc.Server) LogStream(io.camunda.zeebe.logstreams.log.LogStream) ZbColumnFamilies(io.camunda.zeebe.engine.state.ZbColumnFamilies) ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) LogStreamReader(io.camunda.zeebe.logstreams.log.LogStreamReader)

Aggregations

StreamProcessor (io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor)2 ZbColumnFamilies (io.camunda.zeebe.engine.state.ZbColumnFamilies)2 LogStream (io.camunda.zeebe.logstreams.log.LogStream)2 LogStreamReader (io.camunda.zeebe.logstreams.log.LogStreamReader)2 ActorScheduler (io.camunda.zeebe.util.sched.ActorScheduler)2 ControlledActorClock (io.camunda.zeebe.util.sched.clock.ControlledActorClock)2 Server (io.grpc.Server)2