io.aeron.archive.client.RecordingDescriptorConsumer Java Examples
The following examples show how to use
io.aeron.archive.client.RecordingDescriptorConsumer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AeronUtil.java From benchmarks with Apache License 2.0 | 5 votes |
static long findLastRecordingId( final AeronArchive aeronArchive, final String recordingChannel, final int recordingStreamId) { final MutableLong lastRecordingId = new MutableLong(); final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> lastRecordingId.set(recordingId); int foundCount; do { foundCount = aeronArchive.listRecordingsForUri(0, 1, recordingChannel, recordingStreamId, consumer); } while (0 == foundCount); return lastRecordingId.get(); }
Example #2
Source File: CatalogView.java From aeron with Apache License 2.0 | 5 votes |
/** * List all recording descriptors in a {@link Catalog}. * * @param archiveDir the directory containing the {@link Catalog}. * @param consumer to which the descriptor are dispatched. * @return the count of entries listed. */ public static int listRecordings(final File archiveDir, final RecordingDescriptorConsumer consumer) { try (Catalog catalog = new Catalog(archiveDir, System::currentTimeMillis)) { return catalog.forEach(new RecordingDescriptorConsumerAdapter(consumer)); } }
Example #3
Source File: ReplayedBasicSubscriber.java From aeron with Apache License 2.0 | 5 votes |
private static long findLatestRecording(final AeronArchive archive) { final MutableLong lastRecordingId = new MutableLong(); final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> lastRecordingId.set(recordingId); final long fromRecordingId = 0L; final int recordCount = 100; final int foundCount = archive.listRecordingsForUri(fromRecordingId, recordCount, CHANNEL, STREAM_ID, consumer); if (foundCount == 0) { throw new IllegalStateException("no recordings found"); } return lastRecordingId.get(); }
Example #4
Source File: EmbeddedReplayThroughput.java From aeron with Apache License 2.0 | 5 votes |
private long findRecordingId(final String expectedChannel) { final MutableLong foundRecordingId = new MutableLong(); final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> foundRecordingId.set(recordingId); final int recordingsFound = aeronArchive.listRecordingsForUri( 0L, 10, expectedChannel, STREAM_ID, consumer); if (1 != recordingsFound) { throw new IllegalStateException("should have been only one recording"); } return foundRecordingId.get(); }
Example #5
Source File: CatalogView.java From aeron with Apache License 2.0 | 4 votes |
RecordingDescriptorConsumerAdapter(final RecordingDescriptorConsumer consumer) { this.consumer = consumer; }
Example #6
Source File: CatalogView.java From aeron with Apache License 2.0 | 3 votes |
/** * List a recording descriptor for a single recording id. * <p> * If the recording id is not found then nothing is returned. * * @param archiveDir the directory containing the {@link Catalog}. * @param recordingId to view * @param consumer to which the descriptor are dispatched. * @return the true of a descriptor is found. */ public static boolean listRecording( final File archiveDir, final long recordingId, final RecordingDescriptorConsumer consumer) { try (Catalog catalog = new Catalog(archiveDir, System::currentTimeMillis)) { return catalog.forEntry(recordingId, new RecordingDescriptorConsumerAdapter(consumer)); } }