public Stream<LoggedEvent> events(final String logName) { final LogStream logStream = managedLogs.get(logName); final LogStreamReader reader = new BufferedLogStreamReader(logStream); closeables.manage(reader); reader.seekToFirstEvent(); final Iterable<LoggedEvent> iterable = () -> reader; return StreamSupport.stream(iterable.spliterator(), false); }
public Stream<LoggedEvent> events(final String logName) { final LogStream logStream = managedLogs.get(logName); final LogStreamReader reader = new BufferedLogStreamReader(logStream); closeables.manage(reader); reader.seekToFirstEvent(); final Iterable<LoggedEvent> iterable = () -> reader; return StreamSupport.stream(iterable.spliterator(), false); }
public StreamProcessorControl initStreamProcessor( final String log, final int streamProcessorId, final ZeebeDbFactory zeebeDbFactory, final StreamProcessorFactory streamProcessorFactory) { final LogStream stream = getLogStream(log); final StreamProcessorControlImpl control = new StreamProcessorControlImpl( stream, zeebeDbFactory, streamProcessorFactory, streamProcessorId); closeables.manage(control); return control; }
public StreamProcessorControl initStreamProcessor( final String log, final int streamProcessorId, final ZeebeDbFactory zeebeDbFactory, final StreamProcessorFactory streamProcessorFactory) { final LogStream stream = getLogStream(log); final StreamProcessorControlImpl control = new StreamProcessorControlImpl( stream, zeebeDbFactory, streamProcessorFactory, streamProcessorId); closeables.manage(control); return control; }
public LogStream createLogStream(final String name, final int partitionId) { final String rootPath = storageDirectory.getAbsolutePath(); final LogStream logStream = LogStreams.createFsLogStream(partitionId) .logRootPath(rootPath) .serviceContainer(serviceContainer) .logName(name) .deleteOnClose(true) .build() .join(); actorScheduler .submitActor( new Actor() { @Override protected void onActorStarting() { final ActorCondition condition = actor.onCondition( "on-append", () -> logStream.setCommitPosition(Long.MAX_VALUE)); logStream.registerOnAppendCondition(condition); } }) .join(); logStream.openAppender().join(); managedLogs.put(name, logStream); closeables.manage(logStream); return logStream; }
public LogStream createLogStream(final String name, final int partitionId) { final String rootPath = storageDirectory.getAbsolutePath(); final LogStream logStream = LogStreams.createFsLogStream(partitionId) .logRootPath(rootPath) .serviceContainer(serviceContainer) .logName(name) .deleteOnClose(true) .build() .join(); actorScheduler .submitActor( new Actor() { @Override protected void onActorStarting() { final ActorCondition condition = actor.onCondition( "on-append", () -> logStream.setCommitPosition(Long.MAX_VALUE)); logStream.registerOnAppendCondition(condition); } }) .join(); logStream.openAppender().join(); managedLogs.put(name, logStream); closeables.manage(logStream); return logStream; }