Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide LogStream with a clock #1226

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.camunda.zeebe.scheduler.ActorSchedulingService;
import io.camunda.zeebe.scheduler.clock.ActorClock;
import io.camunda.zeebe.scheduler.clock.ControlledActorClock;
import io.camunda.zeebe.stream.impl.ControllableStreamClockImpl;
import io.camunda.zeebe.stream.impl.StreamProcessor;
import io.camunda.zeebe.util.FeatureFlags;
import io.grpc.Server;
Expand Down Expand Up @@ -65,7 +66,7 @@ private static ZeebeTestEngine create(final int port, final Consumer<Intent> req
final ActorScheduler scheduler = createAndStartActorScheduler(clock);

final InMemoryLogStorage logStorage = new InMemoryLogStorage();
final LogStream logStream = createLogStream(logStorage, scheduler, partitionId);
final LogStream logStream = createLogStream(logStorage, scheduler, partitionId, clock);

final CommandWriter commandWriter = new CommandWriter(logStream.newLogStreamWriter());
final CommandSender commandSender = new CommandSender(commandWriter);
Expand All @@ -89,7 +90,8 @@ private static ZeebeTestEngine create(final int port, final Consumer<Intent> req
grpcResponseWriter,
partitionCount,
commandSender,
jobStreamer);
jobStreamer,
clock);

final EngineStateMonitor engineStateMonitor =
new EngineStateMonitor(logStorage, streamProcessor);
Expand Down Expand Up @@ -121,11 +123,15 @@ private static ActorScheduler createAndStartActorScheduler(final ActorClock cloc
}

private static LogStream createLogStream(
final LogStorage logStorage, final ActorSchedulingService scheduler, final int partitionId) {
final LogStorage logStorage,
final ActorSchedulingService scheduler,
final int partitionId,
final ActorClock clock) {
return LogStream.builder()
.withPartitionId(partitionId)
.withLogStorage(logStorage)
.withActorSchedulingService(scheduler)
.withClock(clock)
.build();
}

Expand All @@ -141,7 +147,8 @@ private static StreamProcessor createStreamProcessor(
final GrpcResponseWriter grpcResponseWriter,
final int partitionCount,
final CommandSender commandSender,
final JobStreamer jobStreamer) {
final JobStreamer jobStreamer,
final ActorClock clock) {
return StreamProcessor.builder()
.logStream(logStream)
.zeebeDb(database)
Expand All @@ -160,6 +167,7 @@ private static StreamProcessor createStreamProcessor(
jobStreamer),
new EngineConfiguration())))
.actorSchedulingService(scheduler)
.clock(new ControllableStreamClockImpl(clock))
.build();
}
}
Loading