use of io.aeron.archive.client.ArchiveProxy in project aeron by real-logic.
the class ArchiveTest method replayExclusivePublicationWhileRecording.
@Test(timeout = 10_000)
public void replayExclusivePublicationWhileRecording() {
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 = MESSAGE_COUNT;
final CountDownLatch streamConsumed = new CountDownLatch(2);
prepMessagesAndListener(recordingEvents, messageCount, streamConsumed);
replayConsumer = validateActiveRecordingReplay(archiveProxy, termBufferLength, initialTermId, maxPayloadLength, messageCount, streamConsumed);
publishDataToBeRecorded(recordedPublication, messageCount);
await(streamConsumed);
}
use of io.aeron.archive.client.ArchiveProxy in project Aeron by real-logic.
the class ArchiveTest method replayExclusivePublicationWhileRecording.
@ParameterizedTest
@MethodSource("threadingModes")
@InterruptAfter(10)
public void replayExclusivePublicationWhileRecording(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);
final CountDownLatch latch = new CountDownLatch(2);
prepMessagesAndListener(recordingEvents, latch);
replayConsumer = validateActiveRecordingReplay(archiveProxy, termBufferLength, initialTermId, maxPayloadLength, latch);
publishDataToBeRecorded(recordedPublication);
await(latch);
}
use of io.aeron.archive.client.ArchiveProxy in project aeron by real-logic.
the class ArchiveTest method replayExclusivePublicationWhileRecording.
@ParameterizedTest
@MethodSource("threadingModes")
@InterruptAfter(10)
public void replayExclusivePublicationWhileRecording(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);
final CountDownLatch latch = new CountDownLatch(2);
prepMessagesAndListener(recordingEvents, latch);
replayConsumer = validateActiveRecordingReplay(archiveProxy, termBufferLength, initialTermId, maxPayloadLength, latch);
publishDataToBeRecorded(recordedPublication);
await(latch);
}
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);
}
Aggregations