Search in sources :

Example 1 with LogStorage

use of io.camunda.zeebe.logstreams.storage.LogStorage in project zeebe-process-test by camunda.

the class EngineFactory method createLogStream.

private static LogStream createLogStream(final LogStorage logStorage, final ActorSchedulingService scheduler, final int partitionId) {
    final LogStreamBuilder builder = LogStream.builder().withPartitionId(partitionId).withLogStorage(logStorage).withActorSchedulingService(scheduler);
    final CompletableFuture<LogStream> theFuture = new CompletableFuture<>();
    scheduler.submitActor(Actor.wrap((control) -> builder.buildAsync().onComplete((logStream, failure) -> {
        if (failure != null) {
            theFuture.completeExceptionally(failure);
        } else {
            theFuture.complete(logStream);
        }
    })));
    return theFuture.join();
}
Also used : ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) StreamProcessor(io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor) LogStreamBuilder(io.camunda.zeebe.logstreams.log.LogStreamBuilder) LogStorage(io.camunda.zeebe.logstreams.storage.LogStorage) InMemoryDbFactory(io.camunda.zeebe.process.test.engine.db.InMemoryDbFactory) CompletableFuture(java.util.concurrent.CompletableFuture) ZeebeTestEngine(io.camunda.zeebe.process.test.api.ZeebeTestEngine) EngineProcessors(io.camunda.zeebe.engine.processing.EngineProcessors) ZbColumnFamilies(io.camunda.zeebe.engine.state.ZbColumnFamilies) LogStreamReader(io.camunda.zeebe.logstreams.log.LogStreamReader) ZeebeDb(io.camunda.zeebe.db.ZeebeDb) LogStream(io.camunda.zeebe.logstreams.log.LogStream) EventAppliers(io.camunda.zeebe.engine.state.appliers.EventAppliers) ServerBuilder(io.grpc.ServerBuilder) ActorClock(io.camunda.zeebe.util.sched.clock.ActorClock) ActorSchedulingService(io.camunda.zeebe.util.sched.ActorSchedulingService) Actor(io.camunda.zeebe.util.sched.Actor) Server(io.grpc.Server) ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) CompletableFuture(java.util.concurrent.CompletableFuture) LogStreamBuilder(io.camunda.zeebe.logstreams.log.LogStreamBuilder) LogStream(io.camunda.zeebe.logstreams.log.LogStream)

Example 2 with LogStorage

use of io.camunda.zeebe.logstreams.storage.LogStorage in project zeebe-process-test by camunda-cloud.

the class EngineFactory method createLogStream.

private static LogStream createLogStream(final LogStorage logStorage, final ActorSchedulingService scheduler, final int partitionId) {
    final LogStreamBuilder builder = LogStream.builder().withPartitionId(partitionId).withLogStorage(logStorage).withActorSchedulingService(scheduler);
    final CompletableFuture<LogStream> theFuture = new CompletableFuture<>();
    scheduler.submitActor(Actor.wrap((control) -> builder.buildAsync().onComplete((logStream, failure) -> {
        if (failure != null) {
            theFuture.completeExceptionally(failure);
        } else {
            theFuture.complete(logStream);
        }
    })));
    return theFuture.join();
}
Also used : ControlledActorClock(io.camunda.zeebe.util.sched.clock.ControlledActorClock) StreamProcessor(io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor) LogStreamBuilder(io.camunda.zeebe.logstreams.log.LogStreamBuilder) LogStorage(io.camunda.zeebe.logstreams.storage.LogStorage) InMemoryDbFactory(io.camunda.zeebe.process.test.engine.db.InMemoryDbFactory) CompletableFuture(java.util.concurrent.CompletableFuture) ZeebeTestEngine(io.camunda.zeebe.process.test.api.ZeebeTestEngine) EngineProcessors(io.camunda.zeebe.engine.processing.EngineProcessors) ZbColumnFamilies(io.camunda.zeebe.engine.state.ZbColumnFamilies) LogStreamReader(io.camunda.zeebe.logstreams.log.LogStreamReader) ZeebeDb(io.camunda.zeebe.db.ZeebeDb) LogStream(io.camunda.zeebe.logstreams.log.LogStream) EventAppliers(io.camunda.zeebe.engine.state.appliers.EventAppliers) ServerBuilder(io.grpc.ServerBuilder) ActorClock(io.camunda.zeebe.util.sched.clock.ActorClock) ActorSchedulingService(io.camunda.zeebe.util.sched.ActorSchedulingService) Actor(io.camunda.zeebe.util.sched.Actor) Server(io.grpc.Server) ActorScheduler(io.camunda.zeebe.util.sched.ActorScheduler) CompletableFuture(java.util.concurrent.CompletableFuture) LogStreamBuilder(io.camunda.zeebe.logstreams.log.LogStreamBuilder) LogStream(io.camunda.zeebe.logstreams.log.LogStream)

Aggregations

ZeebeDb (io.camunda.zeebe.db.ZeebeDb)2 EngineProcessors (io.camunda.zeebe.engine.processing.EngineProcessors)2 StreamProcessor (io.camunda.zeebe.engine.processing.streamprocessor.StreamProcessor)2 ZbColumnFamilies (io.camunda.zeebe.engine.state.ZbColumnFamilies)2 EventAppliers (io.camunda.zeebe.engine.state.appliers.EventAppliers)2 LogStream (io.camunda.zeebe.logstreams.log.LogStream)2 LogStreamBuilder (io.camunda.zeebe.logstreams.log.LogStreamBuilder)2 LogStreamReader (io.camunda.zeebe.logstreams.log.LogStreamReader)2 LogStorage (io.camunda.zeebe.logstreams.storage.LogStorage)2 ZeebeTestEngine (io.camunda.zeebe.process.test.api.ZeebeTestEngine)2 InMemoryDbFactory (io.camunda.zeebe.process.test.engine.db.InMemoryDbFactory)2 Actor (io.camunda.zeebe.util.sched.Actor)2 ActorScheduler (io.camunda.zeebe.util.sched.ActorScheduler)2 ActorSchedulingService (io.camunda.zeebe.util.sched.ActorSchedulingService)2 ActorClock (io.camunda.zeebe.util.sched.clock.ActorClock)2 ControlledActorClock (io.camunda.zeebe.util.sched.clock.ControlledActorClock)2 Server (io.grpc.Server)2 ServerBuilder (io.grpc.ServerBuilder)2 CompletableFuture (java.util.concurrent.CompletableFuture)2