Java Code Examples for io.aeron.archive.client.AeronArchive#connect()

The following examples show how to use io.aeron.archive.client.AeronArchive#connect() . 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: Backup.java    From artio with Apache License 2.0 6 votes vote down vote up
public void assertRecordingsTruncated()
{
    try (AeronArchive archive = AeronArchive.connect())
    {
        archive.listRecording(0,
            (controlSessionId,
            correlationId,
            recordingId,
            startTimestamp,
            stopTimestamp,
            startPosition,
            stopPosition,
            initialTermId,
            segmentFileLength,
            termBufferLength,
            mtuLength,
            sessionId,
            streamId,
            strippedChannel,
            originalChannel,
            sourceIdentity) ->
            {
                assertEquals(0, stopPosition);
            });
    }
}
 
Example 2
Source File: EmbeddedRecordingThroughput.java    From aeron with Apache License 2.0 6 votes vote down vote up
public EmbeddedRecordingThroughput()
{
    final String archiveDirName = Archive.Configuration.archiveDirName();
    final File archiveDir = ARCHIVE_DIR_DEFAULT.equals(archiveDirName) ?
        Samples.createTempDir() : new File(archiveDirName);

    archivingMediaDriver = ArchivingMediaDriver.launch(
        new MediaDriver.Context()
            .spiesSimulateConnection(true)
            .dirDeleteOnStart(true),
        new Archive.Context()
            .recordingEventsEnabled(false)
            .archiveDir(archiveDir));

    aeron = Aeron.connect();

    aeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .aeron(aeron));
}
 
Example 3
Source File: ClusteredServiceAgent.java    From aeron with Apache License 2.0 6 votes vote down vote up
private long onTakeSnapshot(final long logPosition, final long leadershipTermId)
{
    final long recordingId;

    try (AeronArchive archive = AeronArchive.connect(ctx.archiveContext().clone());
        ExclusivePublication publication = aeron.addExclusivePublication(
            ctx.snapshotChannel(), ctx.snapshotStreamId()))
    {
        final String channel = ChannelUri.addSessionId(ctx.snapshotChannel(), publication.sessionId());
        archive.startRecording(channel, ctx.snapshotStreamId(), LOCAL, true);
        final CountersReader counters = aeron.countersReader();
        final int counterId = awaitRecordingCounter(publication.sessionId(), counters);
        recordingId = RecordingPos.getRecordingId(counters, counterId);

        snapshotState(publication, logPosition, leadershipTermId);
        checkForClockTick();
        service.onTakeSnapshot(publication);

        awaitRecordingComplete(recordingId, publication.position(), counters, counterId, archive);
    }

    return recordingId;
}
 
Example 4
Source File: ClusteredServiceAgent.java    From aeron with Apache License 2.0 6 votes vote down vote up
private void loadSnapshot(final long recordingId)
{
    try (AeronArchive archive = AeronArchive.connect(ctx.archiveContext().clone()))
    {
        final String channel = ctx.replayChannel();
        final int streamId = ctx.replayStreamId();
        final int sessionId = (int)archive.startReplay(recordingId, 0, NULL_VALUE, channel, streamId);

        final String replaySessionChannel = ChannelUri.addSessionId(channel, sessionId);
        try (Subscription subscription = aeron.addSubscription(replaySessionChannel, streamId))
        {
            final Image image = awaitImage(sessionId, subscription);
            loadState(image);
            service.onStart(this, image);
        }
    }
}
 
Example 5
Source File: SequenceNumberIndexTest.java    From artio with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp()
{
    mediaDriver = launchMediaDriver();
    aeronArchive = AeronArchive.connect();
    final Aeron aeron = aeronArchive.context().aeron();

    aeronArchive.startRecording(IPC_CHANNEL, STREAM_ID, SourceLocation.LOCAL);

    publication = aeron.addPublication(IPC_CHANNEL, STREAM_ID);
    subscription = aeron.addSubscription(IPC_CHANNEL, STREAM_ID);

    buffer = new UnsafeBuffer(new byte[512]);

    deleteFiles();

    recordingIdLookup = new RecordingIdLookup(new YieldingIdleStrategy(), aeron.countersReader());
    writer = newWriter(inMemoryBuffer);
    reader = new SequenceNumberIndexReader(inMemoryBuffer, errorHandler, recordingIdLookup, null);
}
 
Example 6
Source File: ArchiveLoggingAgentTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
private void testArchiveLogging(final String enabledEvents, final EnumSet<ArchiveEventCode> expectedEvents)
    throws InterruptedException
{
    before(enabledEvents, expectedEvents);

    final String aeronDirectoryName = testDir.toPath().resolve("media").toString();

    final MediaDriver.Context mediaDriverCtx = new MediaDriver.Context()
        .errorHandler(Tests::onError)
        .aeronDirectoryName(aeronDirectoryName)
        .dirDeleteOnStart(true)
        .threadingMode(ThreadingMode.SHARED);

    final AeronArchive.Context aeronArchiveContext = new AeronArchive.Context()
        .aeronDirectoryName(aeronDirectoryName)
        .controlRequestChannel("aeron:udp?term-length=64k|endpoint=localhost:8010")
        .controlRequestStreamId(100)
        .controlResponseChannel("aeron:udp?term-length=64k|endpoint=localhost:8020")
        .controlResponseStreamId(101)
        .recordingEventsChannel("aeron:udp?control-mode=dynamic|control=localhost:8030");

    final Archive.Context archiveCtx = new Archive.Context()
        .errorHandler(Tests::onError)
        .archiveDir(new File(testDir, "archive"))
        .deleteArchiveOnStart(true)
        .controlChannel(aeronArchiveContext.controlRequestChannel())
        .controlStreamId(aeronArchiveContext.controlRequestStreamId())
        .localControlStreamId(aeronArchiveContext.controlRequestStreamId())
        .recordingEventsChannel(aeronArchiveContext.recordingEventsChannel())
        .threadingMode(ArchiveThreadingMode.SHARED);

    try (ArchivingMediaDriver ignore1 = ArchivingMediaDriver.launch(mediaDriverCtx, archiveCtx))
    {
        try (AeronArchive ignore2 = AeronArchive.connect(aeronArchiveContext))
        {
            latch.await();
        }
    }
}
 
Example 7
Source File: ArchiveAuthenticationTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
private void connectClient(final CredentialsSupplier credentialsSupplier)
{
    aeron = Aeron.connect(
        new Aeron.Context()
            .aeronDirectoryName(aeronDirectoryName));

    aeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .credentialsSupplier(credentialsSupplier)
            .aeron(aeron));
}
 
Example 8
Source File: BasicArchiveTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void before()
{
    final String aeronDirectoryName = CommonContext.generateRandomDirName();

    mediaDriver = TestMediaDriver.launch(
        new MediaDriver.Context()
            .aeronDirectoryName(aeronDirectoryName)
            .termBufferSparseFile(true)
            .threadingMode(ThreadingMode.SHARED)
            .errorHandler(Tests::onError)
            .spiesSimulateConnection(false)
            .dirDeleteOnStart(true),
        testWatcher);

    archive = Archive.launch(
        new Archive.Context()
            .maxCatalogEntries(Common.MAX_CATALOG_ENTRIES)
            .aeronDirectoryName(aeronDirectoryName)
            .deleteArchiveOnStart(true)
            .archiveDir(new File(SystemUtil.tmpDirName(), "archive"))
            .fileSyncLevel(0)
            .threadingMode(ArchiveThreadingMode.SHARED));

    aeron = Aeron.connect(
        new Aeron.Context()
            .aeronDirectoryName(aeronDirectoryName));

    aeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .aeron(aeron));
}
 
Example 9
Source File: ManageRecordingHistoryTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void before()
{
    archivingMediaDriver = TestMediaDriver.launch(
        new MediaDriver.Context()
            .publicationTermBufferLength(Common.TERM_LENGTH)
            .termBufferSparseFile(true)
            .threadingMode(ThreadingMode.SHARED)
            .errorHandler(Tests::onError)
            .spiesSimulateConnection(true)
            .dirDeleteOnStart(true),
        testWatcher);

    archive = Archive.launch(
        new Archive.Context()
            .maxCatalogEntries(Common.MAX_CATALOG_ENTRIES)
            .segmentFileLength(SEGMENT_LENGTH)
            .deleteArchiveOnStart(true)
            .archiveDir(new File(SystemUtil.tmpDirName(), "archive"))
            .fileSyncLevel(0)
            .threadingMode(ArchiveThreadingMode.SHARED));

    aeron = Aeron.connect();

    aeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .aeron(aeron));
}
 
Example 10
Source File: ReplayMergeTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void before()
{
    final File archiveDir = new File(SystemUtil.tmpDirName(), "archive");

    mediaDriver = TestMediaDriver.launch(
        mediaDriverContext
            .termBufferSparseFile(true)
            .publicationTermBufferLength(TERM_LENGTH)
            .threadingMode(ThreadingMode.SHARED)
            .errorHandler(Tests::onError)
            .spiesSimulateConnection(false)
            .dirDeleteOnStart(true),
        testWatcher);

    archive = Archive.launch(
        new Archive.Context()
            .maxCatalogEntries(MAX_CATALOG_ENTRIES)
            .aeronDirectoryName(mediaDriverContext.aeronDirectoryName())
            .errorHandler(Tests::onError)
            .archiveDir(archiveDir)
            .recordingEventsEnabled(false)
            .threadingMode(ArchiveThreadingMode.SHARED)
            .deleteArchiveOnStart(true));

    aeron = Aeron.connect(
        new Aeron.Context()
            .aeronDirectoryName(mediaDriverContext.aeronDirectoryName()));

    aeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .errorHandler(Tests::onError)
            .aeron(aeron));
}
 
Example 11
Source File: ClusterTool.java    From aeron with Apache License 2.0 5 votes vote down vote up
public static void recoveryPlan(final PrintStream out, final File clusterDir, final int serviceCount)
{
    try (AeronArchive archive = AeronArchive.connect();
        RecordingLog recordingLog = new RecordingLog(clusterDir))
    {
        out.println(recordingLog.createRecoveryPlan(archive, serviceCount));
    }
}
 
Example 12
Source File: FixArchiveScanner.java    From artio with Apache License 2.0 5 votes vote down vote up
public FixArchiveScanner(final Context context)
{
    this.idleStrategy = context.idleStrategy();

    final Aeron.Context aeronContext = new Aeron.Context().aeronDirectoryName(context.aeronDirectoryName());
    aeron = Aeron.connect(aeronContext);
    aeronArchive = AeronArchive.connect(new AeronArchive.Context().aeron(aeron).ownsAeronClient(true));
}
 
Example 13
Source File: ReplayedBasicSubscriber.java    From aeron with Apache License 2.0 5 votes vote down vote up
public static void main(final String[] args)
{
    System.out.println("Subscribing to " + CHANNEL + " on stream id " + STREAM_ID);

    final FragmentHandler fragmentHandler = SamplesUtil.printStringMessage(STREAM_ID);
    final AtomicBoolean running = new AtomicBoolean(true);

    SigInt.register(() -> running.set(false));

    // Create a unique response stream id so not to clash with other archive clients.
    final AeronArchive.Context archiveCtx = new AeronArchive.Context()
        .controlResponseStreamId(AeronArchive.Configuration.controlResponseStreamId() + 2);

    try (AeronArchive archive = AeronArchive.connect(archiveCtx))
    {
        final long recordingId = findLatestRecording(archive);
        final long position = 0L;
        final long length = Long.MAX_VALUE;

        final long sessionId = archive.startReplay(recordingId, position, length, CHANNEL, REPLAY_STREAM_ID);
        final String channel = ChannelUri.addSessionId(CHANNEL, (int)sessionId);

        try (Subscription subscription = archive.context().aeron().addSubscription(channel, REPLAY_STREAM_ID))
        {
            SamplesUtil.subscriberLoop(fragmentHandler, FRAGMENT_COUNT_LIMIT, running).accept(subscription);
            System.out.println("Shutting down...");
        }
    }
}
 
Example 14
Source File: FixEngine.java    From artio with Apache License 2.0 4 votes vote down vote up
private FixEngine(final EngineConfiguration configuration)
{
    try
    {
        this.configuration = configuration;

        timers = new EngineTimers(configuration.clock());
        scheduler = configuration.scheduler();
        scheduler.configure(configuration.aeronContext());
        init(configuration);
        final AeronArchive.Context archiveContext = configuration.aeronArchiveContext();
        final AeronArchive aeronArchive =
            configuration.logAnyMessages() ? AeronArchive.connect(archiveContext.aeron(aeron)) : null;
        recordingCoordinator = new RecordingCoordinator(
            aeron,
            aeronArchive,
            configuration,
            configuration.archiverIdleStrategy(),
            errorHandler);

        final ExclusivePublication replayPublication = replayPublication();
        engineContext = new EngineContext(
            configuration,
            errorHandler,
            replayPublication,
            fixCounters,
            aeron,
            aeronArchive,
            recordingCoordinator);
        initFramer(configuration, fixCounters, replayPublication.sessionId());
        initMonitoringAgent(timers.all(), configuration, aeronArchive);
    }
    catch (final Exception e)
    {
        if (engineContext != null)
        {
            engineContext.completeDuringStartup();
        }

        suppressingClose(this, e);

        throw e;
    }
}
 
Example 15
Source File: ArchiveTest.java    From aeron with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldRecoverRecordingWithNonZeroStartPosition()
{
    final MediaDriver.Context driverCtx = new MediaDriver.Context()
        .dirDeleteOnStart(true)
        .threadingMode(ThreadingMode.SHARED);
    final Context archiveCtx = new Context().threadingMode(SHARED);

    long resultingPosition;
    final int initialPosition = DataHeaderFlyweight.HEADER_LENGTH * 9;
    final long recordingId;

    try (ArchivingMediaDriver ignore = ArchivingMediaDriver.launch(driverCtx.clone(), archiveCtx.clone());
        AeronArchive archive = AeronArchive.connect())
    {
        final int termLength = 128 * 1024;
        final int initialTermId = 29;

        final String channel = new ChannelUriStringBuilder()
            .media(CommonContext.IPC_MEDIA)
            .initialPosition(initialPosition, initialTermId, termLength)
            .build();

        final Publication publication = archive.addRecordedExclusivePublication(channel, 1);
        final DirectBuffer buffer = new UnsafeBuffer("Hello World".getBytes(StandardCharsets.US_ASCII));

        while ((resultingPosition = publication.offer(buffer)) <= 0)
        {
            Tests.yield();
        }

        final Aeron aeron = archive.context().aeron();

        int counterId;
        final int sessionId = publication.sessionId();
        final CountersReader countersReader = aeron.countersReader();
        while (Aeron.NULL_VALUE == (counterId = RecordingPos.findCounterIdBySession(countersReader, sessionId)))
        {
            Tests.yield();
        }

        recordingId = RecordingPos.getRecordingId(countersReader, counterId);

        while (countersReader.getCounterValue(counterId) < resultingPosition)
        {
            Tests.yield();
        }
    }

    try (Catalog catalog = openCatalog(archiveCtx))
    {
        final Catalog.CatalogEntryProcessor catalogEntryProcessor =
            (headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder) ->
            descriptorEncoder.stopPosition(Aeron.NULL_VALUE);

        assertTrue(catalog.forEntry(recordingId, catalogEntryProcessor));
    }

    final Context archiveCtxClone = archiveCtx.clone();
    final MediaDriver.Context driverCtxClone = driverCtx.clone();
    try (ArchivingMediaDriver ignore = ArchivingMediaDriver.launch(driverCtxClone, archiveCtxClone);
        AeronArchive archive = AeronArchive.connect())
    {
        assertEquals(initialPosition, archive.getStartPosition(recordingId));
        assertEquals(resultingPosition, archive.getStopPosition(recordingId));
    }
    finally
    {
        archiveCtxClone.deleteDirectory();
        driverCtxClone.deleteDirectory();
    }
}
 
Example 16
Source File: ArchiveTest.java    From aeron with Apache License 2.0 4 votes vote down vote up
@Test
@Timeout(10)
public void shouldListRegisteredRecordingSubscriptions()
{
    final int expectedStreamId = 7;
    final String channelOne = "aeron:ipc";
    final String channelTwo = "aeron:udp?endpoint=localhost:5678";
    final String channelThree = "aeron:udp?endpoint=localhost:4321";

    final ArrayList<SubscriptionDescriptor> descriptors = new ArrayList<>();
    @SuppressWarnings("Indentation") final RecordingSubscriptionDescriptorConsumer consumer =
        (controlSessionId, correlationId, subscriptionId, streamId, strippedChannel) ->
            descriptors.add(new SubscriptionDescriptor(
                controlSessionId, correlationId, subscriptionId, streamId, strippedChannel));

    final MediaDriver.Context driverCtx = new MediaDriver.Context()
        .dirDeleteOnStart(true)
        .threadingMode(ThreadingMode.SHARED);
    final Context archiveCtx = new Context().threadingMode(SHARED);

    try (ArchivingMediaDriver ignore = ArchivingMediaDriver.launch(driverCtx, archiveCtx);
        AeronArchive archive = AeronArchive.connect())
    {
        final long subIdOne = archive.startRecording(channelOne, expectedStreamId, LOCAL);
        final long subIdTwo = archive.startRecording(channelTwo, expectedStreamId + 1, LOCAL);
        final long subOdThree = archive.startRecording(channelThree, expectedStreamId + 2, LOCAL);

        final int countOne = archive.listRecordingSubscriptions(
            0, 5, "ipc", expectedStreamId, true, consumer);

        assertEquals(1, descriptors.size());
        assertEquals(1, countOne);

        descriptors.clear();
        final int countTwo = archive.listRecordingSubscriptions(
            0, 5, "", expectedStreamId, false, consumer);

        assertEquals(3, descriptors.size());
        assertEquals(3, countTwo);

        archive.stopRecording(subIdTwo);

        descriptors.clear();
        final int countThree = archive.listRecordingSubscriptions(
            0, 5, "", expectedStreamId, false, consumer);

        assertEquals(2, descriptors.size());
        assertEquals(2, countThree);

        assertEquals(1L, descriptors.stream().filter((sd) -> sd.subscriptionId == subIdOne).count());
        assertEquals(1L, descriptors.stream().filter((sd) -> sd.subscriptionId == subOdThree).count());
    }
    finally
    {
        archiveCtx.deleteDirectory();
        driverCtx.deleteDirectory();
    }
}
 
Example 17
Source File: ResetArchiveState.java    From artio with Apache License 2.0 4 votes vote down vote up
private void createArchiver()
{
    aeron = Aeron.connect(configuration.aeronContextClone());
    final AeronArchive.Context archiveContext = configuration.archiveContextClone();
    archive = AeronArchive.connect(archiveContext.aeron(aeron));
}
 
Example 18
Source File: IndexedReplicatedRecording.java    From aeron with Apache License 2.0 4 votes vote down vote up
public IndexedReplicatedRecording()
{
    final String srcAeronDirectoryName = getAeronDirectoryName() + "-src";
    System.out.println("srcAeronDirectoryName=" + srcAeronDirectoryName);
    final String dstAeronDirectoryName = getAeronDirectoryName() + "-dst";
    System.out.println("dstAeronDirectoryName=" + dstAeronDirectoryName);

    final File srcArchiveDir = new File(SystemUtil.tmpDirName(), "src-archive");
    System.out.println("srcArchiveDir=" + srcArchiveDir);
    srcArchivingMediaDriver = ArchivingMediaDriver.launch(
        new MediaDriver.Context()
            .aeronDirectoryName(srcAeronDirectoryName)
            .termBufferSparseFile(true)
            .threadingMode(ThreadingMode.SHARED)
            .errorHandler(Throwable::printStackTrace)
            .spiesSimulateConnection(true)
            .dirDeleteOnShutdown(true)
            .dirDeleteOnStart(true),
        new Archive.Context()
            .maxCatalogEntries(MAX_CATALOG_ENTRIES)
            .controlChannel(SRC_CONTROL_REQUEST_CHANNEL)
            .archiveClientContext(new AeronArchive.Context().controlResponseChannel(SRC_CONTROL_RESPONSE_CHANNEL))
            .recordingEventsEnabled(false)
            .replicationChannel(SRC_REPLICATION_CHANNEL)
            .deleteArchiveOnStart(true)
            .archiveDir(srcArchiveDir)
            .fileSyncLevel(0)
            .threadingMode(ArchiveThreadingMode.SHARED));

    final File dstArchiveDir = new File(SystemUtil.tmpDirName(), "dst-archive");
    System.out.println("dstArchiveDir=" + dstArchiveDir);
    dstArchivingMediaDriver = ArchivingMediaDriver.launch(
        new MediaDriver.Context()
            .aeronDirectoryName(dstAeronDirectoryName)
            .termBufferSparseFile(true)
            .threadingMode(ThreadingMode.SHARED)
            .errorHandler(Throwable::printStackTrace)
            .spiesSimulateConnection(true)
            .dirDeleteOnShutdown(true)
            .dirDeleteOnStart(true),
        new Archive.Context()
            .maxCatalogEntries(MAX_CATALOG_ENTRIES)
            .controlChannel(DST_CONTROL_REQUEST_CHANNEL)
            .archiveClientContext(new AeronArchive.Context().controlResponseChannel(DST_CONTROL_RESPONSE_CHANNEL))
            .recordingEventsEnabled(false)
            .replicationChannel(DST_REPLICATION_CHANNEL)
            .deleteArchiveOnStart(true)
            .archiveDir(dstArchiveDir)
            .fileSyncLevel(0)
            .threadingMode(ArchiveThreadingMode.SHARED));

    srcAeron = Aeron.connect(
        new Aeron.Context()
            .aeronDirectoryName(srcAeronDirectoryName));

    dstAeron = Aeron.connect(
        new Aeron.Context()
            .aeronDirectoryName(dstAeronDirectoryName));

    srcAeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .idleStrategy(YieldingIdleStrategy.INSTANCE)
            .controlRequestChannel(SRC_CONTROL_REQUEST_CHANNEL)
            .controlResponseChannel(SRC_CONTROL_RESPONSE_CHANNEL)
            .aeron(srcAeron));

    dstAeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .idleStrategy(YieldingIdleStrategy.INSTANCE)
            .controlRequestChannel(DST_CONTROL_REQUEST_CHANNEL)
            .controlResponseChannel(DST_CONTROL_RESPONSE_CHANNEL)
            .aeron(dstAeron));
}
 
Example 19
Source File: ArchiveCreator.java    From aeron with Apache License 2.0 4 votes vote down vote up
public static void main(final String[] args)
{
    final String archiveDirName = Archive.Configuration.archiveDirName();
    final File archiveDir = ARCHIVE_DIR_DEFAULT.equals(archiveDirName) ?
        new File("archive") : new File(archiveDirName);

    final MediaDriver.Context driverContext = new MediaDriver.Context()
        .publicationTermBufferLength(TERM_LENGTH)
        .termBufferSparseFile(true)
        .threadingMode(ThreadingMode.SHARED)
        .errorHandler(Throwable::printStackTrace)
        .spiesSimulateConnection(true)
        .dirDeleteOnStart(true);

    final Archive.Context archiveContext = new Archive.Context()
        .maxCatalogEntries(MAX_CATALOG_ENTRIES)
        .segmentFileLength(SEGMENT_LENGTH)
        .deleteArchiveOnStart(true)
        .archiveDir(archiveDir)
        .fileSyncLevel(0)
        .threadingMode(ArchiveThreadingMode.SHARED);

    System.out.println("Creating basic archive at " + archiveContext.archiveDir());

    try (ArchivingMediaDriver ignore = ArchivingMediaDriver.launch(driverContext, archiveContext);
        Aeron aeron = Aeron.connect();
        AeronArchive aeronArchive = AeronArchive.connect(new AeronArchive.Context().aeron(aeron)))
    {
        createRecording(
            aeron,
            aeronArchive,
            0,
            (SEGMENT_LENGTH * 5L) + 1);

        createRecording(
            aeron,
            aeronArchive,
            (long)TERM_LENGTH + (FrameDescriptor.FRAME_ALIGNMENT * 2),
            (SEGMENT_LENGTH * 3L) + 1);

    }
    catch (final Exception ex)
    {
        ex.printStackTrace();
    }
}
 
Example 20
Source File: ArchivePruneSystemTest.java    From artio with Apache License 2.0 4 votes vote down vote up
private AeronArchive newArchive()
{
    final AeronArchive.Context archiveContext = acceptingEngine.configuration().archiveContextClone();
    return AeronArchive.connect(archiveContext);
}