use of io.aeron.archive.client.ArchiveProxy in project aeron by real-logic.
the class ArchiveTest method recordAndReplayRegularPublication.
@Test(timeout = 10_000)
public void recordAndReplayRegularPublication() {
final String controlChannel = archive.context().localControlChannel();
final int controlStreamId = archive.context().localControlStreamId();
final String recordingChannel = archive.context().recordingEventsChannel();
final int recordingStreamId = archive.context().recordingEventsStreamId();
final Publication controlPublication = client.addPublication(controlChannel, controlStreamId);
final Subscription recordingEvents = client.addSubscription(recordingChannel, recordingStreamId);
final ArchiveProxy archiveProxy = new ArchiveProxy(controlPublication);
prePublicationActionsAndVerifications(archiveProxy, controlPublication, recordingEvents);
final Publication recordedPublication = client.addPublication(publishUri, PUBLISH_STREAM_ID);
final int sessionId = recordedPublication.sessionId();
final int termBufferLength = recordedPublication.termBufferLength();
final int initialTermId = recordedPublication.initialTermId();
final int maxPayloadLength = recordedPublication.maxPayloadLength();
final long startPosition = recordedPublication.position();
preSendChecks(archiveProxy, recordingEvents, sessionId, termBufferLength, startPosition);
final int messageCount = prepAndSendMessages(recordingEvents, recordedPublication);
postPublicationValidations(archiveProxy, recordingEvents, termBufferLength, initialTermId, maxPayloadLength, messageCount);
}
use of io.aeron.archive.client.ArchiveProxy in project Aeron by real-logic.
the class ArchiveTest method recordAndReplayConcurrentPublication.
@ParameterizedTest
@MethodSource("threadingModes")
@InterruptAfter(10)
public void recordAndReplayConcurrentPublication(final ThreadingMode threadingMode, final ArchiveThreadingMode archiveThreadingMode) {
before(threadingMode, archiveThreadingMode);
final Publication controlPublication = client.addPublication(archive.context().localControlChannel(), archive.context().localControlStreamId());
final ArchiveProxy archiveProxy = new ArchiveProxy(controlPublication);
final Subscription recordingEvents = client.addSubscription(archive.context().recordingEventsChannel(), archive.context().recordingEventsStreamId());
prePublicationActionsAndVerifications(archiveProxy, controlPublication, recordingEvents);
final Publication recordedPublication = client.addExclusivePublication(publishUri, PUBLISH_STREAM_ID);
final int termBufferLength = recordedPublication.termBufferLength();
final long startPosition = recordedPublication.position();
preSendChecks(archiveProxy, recordingEvents, recordedPublication.sessionId(), termBufferLength, startPosition);
prepAndSendMessages(recordingEvents, recordedPublication);
postPublicationValidations(archiveProxy, recordingEvents, termBufferLength, recordedPublication.initialTermId(), recordedPublication.maxPayloadLength());
}
use of io.aeron.archive.client.ArchiveProxy in project Aeron by real-logic.
the class ArchiveTest method recordAndReplayExclusivePublication.
@ParameterizedTest
@MethodSource("threadingModes")
@InterruptAfter(10)
public void recordAndReplayExclusivePublication(final ThreadingMode threadingMode, final ArchiveThreadingMode archiveThreadingMode) {
before(threadingMode, archiveThreadingMode);
final String controlChannel = archive.context().localControlChannel();
final int controlStreamId = archive.context().localControlStreamId();
final String recordingChannel = archive.context().recordingEventsChannel();
final int recordingStreamId = archive.context().recordingEventsStreamId();
final Publication controlPublication = client.addPublication(controlChannel, controlStreamId);
final Subscription recordingEvents = client.addSubscription(recordingChannel, recordingStreamId);
final ArchiveProxy archiveProxy = new ArchiveProxy(controlPublication);
prePublicationActionsAndVerifications(archiveProxy, controlPublication, recordingEvents);
final ExclusivePublication recordedPublication = client.addExclusivePublication(publishUri, PUBLISH_STREAM_ID);
final int sessionId = recordedPublication.sessionId();
final int termBufferLength = recordedPublication.termBufferLength();
final int initialTermId = recordedPublication.initialTermId();
final int maxPayloadLength = recordedPublication.maxPayloadLength();
final long startPosition = recordedPublication.position();
assertEquals(requestedStartPosition, startPosition);
assertEquals(requestedInitialTermId, recordedPublication.initialTermId());
preSendChecks(archiveProxy, recordingEvents, sessionId, termBufferLength, startPosition);
prepAndSendMessages(recordingEvents, recordedPublication);
postPublicationValidations(archiveProxy, recordingEvents, termBufferLength, initialTermId, maxPayloadLength);
}
use of io.aeron.archive.client.ArchiveProxy in project aeron by real-logic.
the class ArchiveTest method recordAndReplayConcurrentPublication.
@ParameterizedTest
@MethodSource("threadingModes")
@InterruptAfter(10)
public void recordAndReplayConcurrentPublication(final ThreadingMode threadingMode, final ArchiveThreadingMode archiveThreadingMode) {
before(threadingMode, archiveThreadingMode);
final Publication controlPublication = client.addPublication(archive.context().localControlChannel(), archive.context().localControlStreamId());
final ArchiveProxy archiveProxy = new ArchiveProxy(controlPublication);
final Subscription recordingEvents = client.addSubscription(archive.context().recordingEventsChannel(), archive.context().recordingEventsStreamId());
prePublicationActionsAndVerifications(archiveProxy, controlPublication, recordingEvents);
final Publication recordedPublication = client.addExclusivePublication(publishUri, PUBLISH_STREAM_ID);
final int termBufferLength = recordedPublication.termBufferLength();
final long startPosition = recordedPublication.position();
preSendChecks(archiveProxy, recordingEvents, recordedPublication.sessionId(), termBufferLength, startPosition);
prepAndSendMessages(recordingEvents, recordedPublication);
postPublicationValidations(archiveProxy, recordingEvents, termBufferLength, recordedPublication.initialTermId(), recordedPublication.maxPayloadLength());
}
use of io.aeron.archive.client.ArchiveProxy in project aeron by real-logic.
the class ArchiveTest method recordAndReplayExclusivePublication.
@Test(timeout = 10_000)
public void recordAndReplayExclusivePublication() {
final String controlChannel = archive.context().localControlChannel();
final int controlStreamId = archive.context().localControlStreamId();
final String recordingChannel = archive.context().recordingEventsChannel();
final int recordingStreamId = archive.context().recordingEventsStreamId();
final Publication controlPublication = client.addPublication(controlChannel, controlStreamId);
final Subscription recordingEvents = client.addSubscription(recordingChannel, recordingStreamId);
final ArchiveProxy archiveProxy = new ArchiveProxy(controlPublication);
prePublicationActionsAndVerifications(archiveProxy, controlPublication, recordingEvents);
final ExclusivePublication recordedPublication = client.addExclusivePublication(publishUri, PUBLISH_STREAM_ID);
final int sessionId = recordedPublication.sessionId();
final int termBufferLength = recordedPublication.termBufferLength();
final int initialTermId = recordedPublication.initialTermId();
final int maxPayloadLength = recordedPublication.maxPayloadLength();
final long startPosition = recordedPublication.position();
assertThat(startPosition, is(requestedStartPosition));
assertThat(recordedPublication.initialTermId(), is(requestedInitialTermId));
preSendChecks(archiveProxy, recordingEvents, sessionId, termBufferLength, startPosition);
final int messageCount = prepAndSendMessages(recordingEvents, recordedPublication);
postPublicationValidations(archiveProxy, recordingEvents, termBufferLength, initialTermId, maxPayloadLength, messageCount);
}
Aggregations