Search in sources :

Example 6 with RecordingDescriptorConsumer

use of io.aeron.archive.client.RecordingDescriptorConsumer in project aeron by real-logic.

the class ReplayedBasicSubscriber method findLatestRecording.

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();
}
Also used : MutableLong(org.agrona.collections.MutableLong) Subscription(io.aeron.Subscription) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer) SampleConfiguration(io.aeron.samples.SampleConfiguration) AeronArchive(io.aeron.archive.client.AeronArchive) ChannelUri(io.aeron.ChannelUri) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FragmentHandler(io.aeron.logbuffer.FragmentHandler) SamplesUtil(io.aeron.samples.SamplesUtil) SigInt(org.agrona.concurrent.SigInt) MutableLong(org.agrona.collections.MutableLong) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer)

Aggregations

AeronArchive (io.aeron.archive.client.AeronArchive)6 RecordingDescriptorConsumer (io.aeron.archive.client.RecordingDescriptorConsumer)6 MutableLong (org.agrona.collections.MutableLong)6 SampleConfiguration (io.aeron.samples.SampleConfiguration)5 io.aeron (io.aeron)4 MediaDriver (io.aeron.driver.MediaDriver)4 FragmentHandler (io.aeron.logbuffer.FragmentHandler)4 File (java.io.File)4 CloseHelper (org.agrona.CloseHelper)4 Archive (io.aeron.archive.Archive)3 ARCHIVE_DIR_DEFAULT (io.aeron.archive.Archive.Configuration.ARCHIVE_DIR_DEFAULT)3 ArchivingMediaDriver (io.aeron.archive.ArchivingMediaDriver)3 RecordingPos (io.aeron.archive.status.RecordingPos)3 Header (io.aeron.logbuffer.Header)3 BufferUtil.allocateDirectAligned (org.agrona.BufferUtil.allocateDirectAligned)3 DirectBuffer (org.agrona.DirectBuffer)3 SystemUtil.loadPropertiesFiles (org.agrona.SystemUtil.loadPropertiesFiles)3 CountersReader (org.agrona.concurrent.status.CountersReader)3 ContinueBarrier (org.agrona.console.ContinueBarrier)3 ChannelUri (io.aeron.ChannelUri)2