public final class AeronArchive extends Object implements AutoCloseable
This client provides a simple interaction model which is mostly synchronous and may not be optimal.
The underlying components such as the ArchiveProxy
and the ControlResponsePoller
or
RecordingDescriptorPoller
may be used directly if a more asynchronous interaction is required.
Note: This class is threadsafe but the lock can be elided for single threaded access via AeronArchive.Context.lock(Lock)
being set to NoOpLock
.
Modifier and Type | Class and Description |
---|---|
static class |
AeronArchive.AsyncConnect
Allows for the async establishment of an archive session.
|
static class |
AeronArchive.Configuration
Common configuration properties for communicating with an Aeron archive.
|
static class |
AeronArchive.Context
Specialised configuration options for communicating with an Aeron Archive.
|
Modifier and Type | Field and Description |
---|---|
static String |
NOT_CONNECTED_MSG
Indicates the client is no longer connected to an archive.
|
static long |
NULL_LENGTH
Represents a length that has not been set.
|
static long |
NULL_POSITION
Represents a position that has not been set.
|
static long |
NULL_TIMESTAMP
Represents a timestamp that has not been set.
|
Modifier and Type | Method and Description |
---|---|
ExclusivePublication |
addRecordedExclusivePublication(String channel,
int streamId)
Add an
ExclusivePublication and set it up to be recorded. |
Publication |
addRecordedPublication(String channel,
int streamId)
Add a
Publication and set it up to be recorded. |
ArchiveProxy |
archiveProxy()
The
ArchiveProxy for send asynchronous messages to the connected archive. |
static AeronArchive.AsyncConnect |
asyncConnect()
Begin an attempt at creating a connection which can be completed by calling
AeronArchive.AsyncConnect.poll() until
it returns the client, before complete it will return null. |
static AeronArchive.AsyncConnect |
asyncConnect(AeronArchive.Context ctx)
Begin an attempt at creating a connection which can be completed by calling
AeronArchive.AsyncConnect.poll() until
it returns the client, before complete it will return null. |
long |
attachSegments(long recordingId)
Attach segments to the beginning of a recording to restore history that was previously detached.
|
void |
checkForErrorResponse()
Check if an error has been returned for the control session, or if it is no longer connected, and then throw
a
ArchiveException if AeronArchive.Context.errorHandler(ErrorHandler) is not set. |
void |
close()
Notify the archive that this control session is closed, so it can promptly release resources then close the
local resources associated with the client.
|
static AeronArchive |
connect()
Connect to an Aeron archive using a default
AeronArchive.Context . |
static AeronArchive |
connect(AeronArchive.Context ctx)
Connect to an Aeron archive by providing a
AeronArchive.Context . |
AeronArchive.Context |
context()
Get the
AeronArchive.Context used to connect this archive client. |
ControlResponsePoller |
controlResponsePoller()
Get the
ControlResponsePoller for polling additional events on the control channel. |
long |
controlSessionId()
The control session id allocated for this connection to the archive.
|
long |
deleteDetachedSegments(long recordingId)
Delete segments which have been previously detached from a recording.
|
void |
detachSegments(long recordingId,
long newStartPosition)
Detach segments from the beginning of a recording up to the provided new start position.
|
long |
extendRecording(long recordingId,
String channel,
int streamId,
SourceLocation sourceLocation)
Extend an existing, non-active recording of a channel and stream pairing.
|
long |
extendRecording(long recordingId,
String channel,
int streamId,
SourceLocation sourceLocation,
boolean autoStop)
Extend an existing, non-active recording of a channel and stream pairing.
|
long |
findLastMatchingRecording(long minRecordingId,
String channelFragment,
int streamId,
int sessionId)
Find the last recording that matches the given criteria.
|
long |
getRecordingPosition(long recordingId)
Get the position recorded for an active recording.
|
long |
getStartPosition(long recordingId)
Get the start position for a recording.
|
long |
getStopPosition(long recordingId)
Get the stop position for a recording.
|
long |
lastCorrelationId()
The last correlation id used for sending a request to the archive via method on this class.
|
int |
listRecording(long recordingId,
RecordingDescriptorConsumer consumer)
List a recording descriptor for a single recording id.
|
int |
listRecordings(long fromRecordingId,
int recordCount,
RecordingDescriptorConsumer consumer)
List all recording descriptors from a recording id with a limit of record count.
|
int |
listRecordingsForUri(long fromRecordingId,
int recordCount,
String channelFragment,
int streamId,
RecordingDescriptorConsumer consumer)
List recording descriptors from a recording id with a limit of record count for a given channelFragment and
stream id.
|
int |
listRecordingSubscriptions(int pseudoIndex,
int subscriptionCount,
String channelFragment,
int streamId,
boolean applyStreamId,
RecordingSubscriptionDescriptorConsumer consumer)
List active recording subscriptions in the archive.
|
long |
migrateSegments(long srcRecordingId,
long dstRecordingId)
Migrate segments from a source recording and attach them to the beginning or end of a destination recording.
|
String |
pollForErrorResponse()
Poll the response stream once for an error.
|
int |
pollForRecordingSignals()
Poll for
RecordingSignal s for this session which will be dispatched to
AeronArchive.Context.recordingSignalConsumer . |
long |
purgeRecording(long recordingId)
Purge a stopped recording, i.e.
|
long |
purgeSegments(long recordingId,
long newStartPosition)
Purge (detach and delete) segments from the beginning of a recording up to the provided new start position.
|
RecordingDescriptorPoller |
recordingDescriptorPoller()
Get the
RecordingDescriptorPoller for polling recording descriptors on the control channel. |
RecordingSubscriptionDescriptorPoller |
recordingSubscriptionDescriptorPoller()
The
RecordingSubscriptionDescriptorPoller for polling subscription descriptors on the control channel. |
Subscription |
replay(long recordingId,
long position,
long length,
String replayChannel,
int replayStreamId)
Replay a length in bytes of a recording from a position and for convenience create a
Subscription
to receive the replay. |
Subscription |
replay(long recordingId,
long position,
long length,
String replayChannel,
int replayStreamId,
AvailableImageHandler availableImageHandler,
UnavailableImageHandler unavailableImageHandler)
Replay a length in bytes of a recording from a position and for convenience create a
Subscription
to receive the replay. |
Subscription |
replay(long recordingId,
String replayChannel,
int replayStreamId,
ReplayParams replayParams)
Replay a recording based upon the parameters set in ReplayParams.
|
long |
replicate(long srcRecordingId,
int srcControlStreamId,
String srcControlChannel,
ReplicationParams replicationParams)
Replicate a recording from a source archive to a destination which can be considered a backup for a primary
archive.
|
long |
replicate(long srcRecordingId,
long dstRecordingId,
int srcControlStreamId,
String srcControlChannel,
String liveDestination)
Replicate a recording from a source archive to a destination which can be considered a backup for a primary
archive.
|
long |
replicate(long srcRecordingId,
long dstRecordingId,
long stopPosition,
int srcControlStreamId,
String srcControlChannel,
String liveDestination,
String replicationChannel)
Replicate a recording from a source archive to a destination which can be considered a backup for a primary
archive.
|
static long |
segmentFileBasePosition(long startPosition,
long position,
int termBufferLength,
int segmentFileLength)
Position of the recorded stream at the base of a segment file.
|
long |
startBoundedReplay(long recordingId,
long position,
long length,
int limitCounterId,
String replayChannel,
int replayStreamId)
Start a replay for a length in bytes of a recording from a position bounded by a position counter.
|
long |
startRecording(String channel,
int streamId,
SourceLocation sourceLocation)
Start recording a channel and stream pairing.
|
long |
startRecording(String channel,
int streamId,
SourceLocation sourceLocation,
boolean autoStop)
Start recording a channel and stream pairing.
|
long |
startReplay(long recordingId,
long position,
long length,
String replayChannel,
int replayStreamId)
Start a replay for a length in bytes of a recording from a position.
|
long |
startReplay(long recordingId,
String replayChannel,
int replayStreamId,
ReplayParams replayParams)
Start a replay for a recording based upon the parameters set in ReplayParams.
|
void |
stopAllReplays(long recordingId)
Stop all replay sessions for a given recording id or all replays in general.
|
void |
stopRecording(long subscriptionId)
Stop recording for a subscriptionId that has been returned from
startRecording(String, int, SourceLocation) or
extendRecording(long, String, int, SourceLocation) . |
void |
stopRecording(Publication publication)
Stop recording a sessionId specific recording that pertains to the given
Publication . |
void |
stopRecording(String channel,
int streamId)
Stop recording for a channel and stream pairing.
|
void |
stopReplay(long replaySessionId)
Stop an existing replay session.
|
void |
stopReplication(long replicationId)
Stop a replication session by id returned from
replicate(long, long, int, String, String) . |
long |
taggedReplicate(long srcRecordingId,
long dstRecordingId,
long channelTagId,
long subscriptionTagId,
int srcControlStreamId,
String srcControlChannel,
String liveDestination)
Replicate a recording from a source archive to a destination which can be considered a backup for a primary
archive.
|
long |
taggedReplicate(long srcRecordingId,
long dstRecordingId,
long stopPosition,
long channelTagId,
long subscriptionTagId,
int srcControlStreamId,
String srcControlChannel,
String liveDestination,
String replicationChannel)
Replicate a recording from a source archive to a destination which can be considered a backup for a primary
archive.
|
long |
truncateRecording(long recordingId,
long position)
Truncate a stopped recording to a given position that is less than the stopped position.
|
boolean |
tryStopRecording(long subscriptionId)
Try stop a recording for a subscriptionId that has been returned from
startRecording(String, int, SourceLocation) or
extendRecording(long, String, int, SourceLocation) . |
boolean |
tryStopRecording(String channel,
int streamId)
Try to stop a recording for a channel and stream pairing.
|
boolean |
tryStopRecordingByIdentity(long recordingId)
Try stop an active recording by its recording id.
|
boolean |
tryStopReplication(long replicationId)
Attempt to stop a replication session by id returned from
replicate(long, long, int, String, String) . |
public static final long NULL_TIMESTAMP
public static final long NULL_POSITION
public static final long NULL_LENGTH
public static final String NOT_CONNECTED_MSG
public static long segmentFileBasePosition(long startPosition, long position, int termBufferLength, int segmentFileLength)
startPosition
- of the stream.position
- of the stream to calculate the segment base position from.termBufferLength
- of the stream.segmentFileLength
- which is a multiple of term length.public void close()
close
in interface AutoCloseable
public static AeronArchive connect()
AeronArchive.Context
. This will create a control session.public static AeronArchive connect(AeronArchive.Context ctx)
AeronArchive.Context
. This will create a control session.
Before connecting AeronArchive.Context.conclude()
will be called.
If an exception occurs then AeronArchive.Context.close()
will be called.
ctx
- for connection configuration.public static AeronArchive.AsyncConnect asyncConnect()
AeronArchive.AsyncConnect.poll()
until
it returns the client, before complete it will return null.AeronArchive.AsyncConnect
that can be polled for completion.public static AeronArchive.AsyncConnect asyncConnect(AeronArchive.Context ctx)
AeronArchive.AsyncConnect.poll()
until
it returns the client, before complete it will return null.ctx
- for the archive connection.AeronArchive.AsyncConnect
that can be polled for completion.public AeronArchive.Context context()
AeronArchive.Context
used to connect this archive client.AeronArchive.Context
used to connect this archive client.public long lastCorrelationId()
public long controlSessionId()
public ArchiveProxy archiveProxy()
ArchiveProxy
for send asynchronous messages to the connected archive.ArchiveProxy
for send asynchronous messages to the connected archive.public ControlResponsePoller controlResponsePoller()
ControlResponsePoller
for polling additional events on the control channel.ControlResponsePoller
for polling additional events on the control channel.public RecordingDescriptorPoller recordingDescriptorPoller()
RecordingDescriptorPoller
for polling recording descriptors on the control channel.RecordingDescriptorPoller
for polling recording descriptors on the control channel.public RecordingSubscriptionDescriptorPoller recordingSubscriptionDescriptorPoller()
RecordingSubscriptionDescriptorPoller
for polling subscription descriptors on the control channel.RecordingSubscriptionDescriptorPoller
for polling subscription descriptors on the control
channel.public String pollForErrorResponse()
NOT_CONNECTED_MSG
.public void checkForErrorResponse()
ArchiveException
if AeronArchive.Context.errorHandler(ErrorHandler)
is not set.
To check for an error response without raising an exception then try pollForErrorResponse()
.
pollForErrorResponse()
public int pollForRecordingSignals()
RecordingSignal
s for this session which will be dispatched to
AeronArchive.Context.recordingSignalConsumer
.public Publication addRecordedPublication(String channel, int streamId)
Publication
and set it up to be recorded. If this is not the first,
i.e. Publication.isOriginal()
is true, then an ArchiveException
will be thrown and the recording not initiated.
This is a sessionId specific recording.
channel
- for the publication.streamId
- for the publication.Publication
ready for use.public ExclusivePublication addRecordedExclusivePublication(String channel, int streamId)
ExclusivePublication
and set it up to be recorded.
This is a sessionId specific recording.
channel
- for the publication.streamId
- for the publication.ExclusivePublication
ready for use.public long startRecording(String channel, int streamId, SourceLocation sourceLocation)
Channels that include sessionId parameters are considered different from channels without sessionIds. If a publication matches both a sessionId specific channel recording and a non-sessionId specific recording, it will be recorded twice.
channel
- to be recorded.streamId
- to be recorded.sourceLocation
- of the publication to be recorded.Subscription.registrationId()
, of the recording. This can be
passed to stopRecording(long)
.public long startRecording(String channel, int streamId, SourceLocation sourceLocation, boolean autoStop)
Channels that include sessionId parameters are considered different from channels without sessionIds. If a publication matches both a sessionId specific channel recording and a non-sessionId specific recording, it will be recorded twice.
channel
- to be recorded.streamId
- to be recorded.sourceLocation
- of the publication to be recorded.autoStop
- if the recording should be automatically stopped when complete.Subscription.registrationId()
, of the recording. This can be
passed to stopRecording(long)
. However, if is autoStop is true then no need to stop the recording
unless you want to abort early.public long extendRecording(long recordingId, String channel, int streamId, SourceLocation sourceLocation)
The channel must be configured for the initial position from which it will be extended. This can be done
with ChannelUriStringBuilder.initialPosition(long, int, int)
. The details required to initialise can
be found by calling listRecording(long, RecordingDescriptorConsumer)
.
recordingId
- of the existing recording.channel
- to be recorded.streamId
- to be recorded.sourceLocation
- of the publication to be recorded.Subscription.registrationId()
, of the recording. This can be
passed to stopRecording(long)
.public long extendRecording(long recordingId, String channel, int streamId, SourceLocation sourceLocation, boolean autoStop)
The channel must be configured for the initial position from which it will be extended. This can be done
with ChannelUriStringBuilder.initialPosition(long, int, int)
. The details required to initialise can
be found by calling listRecording(long, RecordingDescriptorConsumer)
.
recordingId
- of the existing recording.channel
- to be recorded.streamId
- to be recorded.sourceLocation
- of the publication to be recorded.autoStop
- if the recording should be automatically stopped when complete.Subscription.registrationId()
, of the recording. This can be
passed to stopRecording(long)
. However, if is autoStop is true then no need to stop the recording
unless you want to abort early.public void stopRecording(String channel, int streamId)
Channels that include sessionId parameters are considered different from channels without sessionIds. Stopping a recording on a channel without a sessionId parameter will not stop the recording of any sessionId specific recordings that use the same channel and streamId.
channel
- to stop recording for.streamId
- to stop recording for.public boolean tryStopRecording(String channel, int streamId)
Channels that include sessionId parameters are considered different from channels without sessionIds. Stopping a recording on a channel without a sessionId parameter will not stop the recording of any sessionId specific recordings that use the same channel and streamId.
channel
- to stop recording for.streamId
- to stop recording for.true
if the recording was stopped or false if the subscription is not currently active.public void stopRecording(long subscriptionId)
startRecording(String, int, SourceLocation)
or
extendRecording(long, String, int, SourceLocation)
.subscriptionId
- is the Subscription.registrationId()
for the recording in the archive.public boolean tryStopRecording(long subscriptionId)
startRecording(String, int, SourceLocation)
or
extendRecording(long, String, int, SourceLocation)
.subscriptionId
- is the Subscription.registrationId()
for the recording in the archive.true
if the recording was stopped or false if the subscription is not currently active.public boolean tryStopRecordingByIdentity(long recordingId)
recordingId
- for which active recording should be stopped.true
if the recording was stopped or false if the recording is not currently active.public void stopRecording(Publication publication)
Publication
.publication
- to stop recording for.public long startReplay(long recordingId, long position, long length, String replayChannel, int replayStreamId)
NULL_POSITION
then the stream will be replayed from the start.
The lower 32-bits of the returned value contains the Image.sessionId()
of the received replay. All
64-bits are required to uniquely identify the replay when calling stopReplay(long)
. The lower 32-bits
can be obtained by casting the long
value to an int
.
recordingId
- to be replayed.position
- from which the replay should begin or NULL_POSITION
if from the start.length
- of the stream to be replayed. Use Long.MAX_VALUE
to follow a live recording or
NULL_LENGTH
to replay the whole stream of unknown length.replayChannel
- to which the replay should be sent.replayStreamId
- to which the replay should be sent.Image.sessionId()
of the received
replay for correlation with the matching channel and stream id in the lower 32 bits.public long startBoundedReplay(long recordingId, long position, long length, int limitCounterId, String replayChannel, int replayStreamId)
NULL_POSITION
then the stream will be replayed from the start.
The lower 32-bits of the returned value contains the Image.sessionId()
of the received replay. All
64-bits are required to uniquely identify the replay when calling stopReplay(long)
. The lower 32-bits
can be obtained by casting the long
value to an int
.
recordingId
- to be replayed.position
- from which the replay should begin or NULL_POSITION
if from the start.length
- of the stream to be replayed. Use Long.MAX_VALUE
to follow a live recording or
NULL_LENGTH
to replay the whole stream of unknown length.limitCounterId
- to use to bound replay.replayChannel
- to which the replay should be sent.replayStreamId
- to which the replay should be sent.Image.sessionId()
of the received
replay for correlation with the matching channel and stream id in the lower 32 bits.public long startReplay(long recordingId, String replayChannel, int replayStreamId, ReplayParams replayParams)
recordingId
- to be replayed.replayChannel
- to which the replay should be sent.replayStreamId
- to which the replay should be sent.replayParams
- optional parameters for the replayImage.sessionId()
of the received
replay for correlation with the matching channel and stream id in the lower 32 bits.ReplayParams
public void stopReplay(long replaySessionId)
replaySessionId
- to stop replay for which would have been returned from
startReplay(long, long, long, String, int)
.public void stopAllReplays(long recordingId)
recordingId
- to stop replay for or Aeron.NULL_VALUE
for all replays.public Subscription replay(long recordingId, long position, long length, String replayChannel, int replayStreamId)
Subscription
to receive the replay. If the position is NULL_POSITION
then the stream will be replayed from the start.recordingId
- to be replayed.position
- from which the replay should begin or NULL_POSITION
if from the start.length
- of the stream to be replayed or Long.MAX_VALUE
to follow a live recording.replayChannel
- to which the replay should be sent.replayStreamId
- to which the replay should be sent.Subscription
for consuming the replay.public Subscription replay(long recordingId, long position, long length, String replayChannel, int replayStreamId, AvailableImageHandler availableImageHandler, UnavailableImageHandler unavailableImageHandler)
Subscription
to receive the replay. If the position is NULL_POSITION
then the stream will be replayed from the start.recordingId
- to be replayed.position
- from which the replay should begin or NULL_POSITION
if from the start.length
- of the stream to be replayed or Long.MAX_VALUE
to follow a live recording.replayChannel
- to which the replay should be sent.replayStreamId
- to which the replay should be sent.availableImageHandler
- to be called when the replay image becomes available.unavailableImageHandler
- to be called when the replay image goes unavailable.Subscription
for consuming the replay.public Subscription replay(long recordingId, String replayChannel, int replayStreamId, ReplayParams replayParams)
recordingId
- to be replayed.replayChannel
- to which the replay should be sent.replayStreamId
- to which the replay should be sent.replayParams
- optional parameters for the replaySubscription
for consuming the replay.ReplayParams
public int listRecordings(long fromRecordingId, int recordCount, RecordingDescriptorConsumer consumer)
If the recording id is greater than the largest known id then nothing is returned.
fromRecordingId
- at which to begin the listing.recordCount
- to limit for each query.consumer
- to which the descriptors are dispatched.public int listRecordingsForUri(long fromRecordingId, int recordCount, String channelFragment, int streamId, RecordingDescriptorConsumer consumer)
If the recording id is greater than the largest known id then nothing is returned.
fromRecordingId
- at which to begin the listing.recordCount
- to limit for each query.channelFragment
- for a contains match on the original channel stored with the archive descriptor.streamId
- to match.consumer
- to which the descriptors are dispatched.public int listRecording(long recordingId, RecordingDescriptorConsumer consumer)
If the recording id is greater than the largest known id then nothing is returned.
recordingId
- at which to begin the listing.consumer
- to which the descriptors are dispatched.public long getStartPosition(long recordingId)
recordingId
- of the recording for which the position is required.getStopPosition(long)
public long getRecordingPosition(long recordingId)
NULL_POSITION
.recordingId
- of the active recording for which the position is required.NULL_POSITION
if recording not active.getStopPosition(long)
public long getStopPosition(long recordingId)
recordingId
- of the active recording for which the position is required.NULL_POSITION
if still active.getRecordingPosition(long)
public long findLastMatchingRecording(long minRecordingId, String channelFragment, int streamId, int sessionId)
minRecordingId
- to search back to.channelFragment
- for a contains match on the original channel stored with the archive descriptor.streamId
- of the recording to match.sessionId
- of the recording to match.Aeron.NULL_VALUE
if not found.public long truncateRecording(long recordingId, long position)
recordingId
- of the stopped recording to be truncated.position
- to which the recording will be truncated.public long purgeRecording(long recordingId)
RecordingState.INVALID
and delete the corresponding segment files. The space in the Catalog will be reclaimed upon compaction.recordingId
- of the stopped recording to be purged.public int listRecordingSubscriptions(int pseudoIndex, int subscriptionCount, String channelFragment, int streamId, boolean applyStreamId, RecordingSubscriptionDescriptorConsumer consumer)
startRecording(String, int, SourceLocation)
or a
extendRecording(long, String, int, SourceLocation)
. The returned subscription id can be used for
passing to stopRecording(long)
.pseudoIndex
- in the active list at which to begin for paging.subscriptionCount
- to get in a listing.channelFragment
- to do a contains match on the stripped channel URI. Empty string is match all.streamId
- to match on the subscription.applyStreamId
- true if the stream id should be matched.consumer
- for the matched subscription descriptors.public long replicate(long srcRecordingId, long dstRecordingId, int srcControlStreamId, String srcControlChannel, String liveDestination)
Aeron.NULL_VALUE
then a new destination recording is created,
otherwise the provided destination recording id will be extended. The details of the source recording
descriptor will be replicated.
For a source recording that is still active the replay can merge with the live stream and then follow it directly and no longer require the replay from the source. This would require a multicast live destination.
Errors will be reported asynchronously and can be checked for with pollForErrorResponse()
or checkForErrorResponse()
.
srcRecordingId
- recording id which must exist in the source archive.dstRecordingId
- recording to extend in the destination, otherwise Aeron.NULL_VALUE
.srcControlStreamId
- remote control stream id for the source archive to instruct the replay on.srcControlChannel
- remote control channel for the source archive to instruct the replay on.liveDestination
- destination for the live stream if merge is required. Empty or null for no merge.stopReplication(long)
.public long replicate(long srcRecordingId, long dstRecordingId, long stopPosition, int srcControlStreamId, String srcControlChannel, String liveDestination, String replicationChannel)
Aeron.NULL_VALUE
then a new destination recording is created,
otherwise the provided destination recording id will be extended. The details of the source recording
descriptor will be replicated.
For a source recording that is still active the replay can merge with the live stream and then follow it directly and no longer require the replay from the source. This would require a multicast live destination.
Errors will be reported asynchronously and can be checked for with pollForErrorResponse()
or checkForErrorResponse()
.
Stop recording this stream when the position of the destination reaches the specified stop position.
srcRecordingId
- recording id which must exist in the source archive.dstRecordingId
- recording to extend in the destination, otherwise Aeron.NULL_VALUE
.stopPosition
- position to stop the replication. NULL_POSITION
to stop at end
of current recording.srcControlStreamId
- remote control stream id for the source archive to instruct the replay on.srcControlChannel
- remote control channel for the source archive to instruct the replay on.liveDestination
- destination for the live stream if merge is required. Empty or null for no merge.replicationChannel
- channel over which the replication will occur. Empty or null for default channel.stopReplication(long)
.public long taggedReplicate(long srcRecordingId, long dstRecordingId, long channelTagId, long subscriptionTagId, int srcControlStreamId, String srcControlChannel, String liveDestination)
Aeron.NULL_VALUE
then a new destination recording is created,
otherwise the provided destination recording id will be extended. The details of the source recording
descriptor will be replicated. The subscription used in the archive will be tagged with the provided tags.
For a source recording that is still active the replay can merge with the live stream and then follow it directly and no longer require the replay from the source. This would require a multicast live destination.
Errors will be reported asynchronously and can be checked for with pollForErrorResponse()
or checkForErrorResponse()
.
srcRecordingId
- recording id which must exist in the source archive.dstRecordingId
- recording to extend in the destination, otherwise Aeron.NULL_VALUE
.channelTagId
- used to tag the replication subscription.subscriptionTagId
- used to tag the replication subscription.srcControlStreamId
- remote control stream id for the source archive to instruct the replay on.srcControlChannel
- remote control channel for the source archive to instruct the replay on.liveDestination
- destination for the live stream if merge is required. Empty or null for no merge.stopReplication(long)
.public long taggedReplicate(long srcRecordingId, long dstRecordingId, long stopPosition, long channelTagId, long subscriptionTagId, int srcControlStreamId, String srcControlChannel, String liveDestination, String replicationChannel)
Aeron.NULL_VALUE
then a new destination recording is created,
otherwise the provided destination recording id will be extended. The details of the source recording
descriptor will be replicated. The subscription used in the archive will be tagged with the provided tags.
For a source recording that is still active the replay can merge with the live stream and then follow it directly and no longer require the replay from the source. This would require a multicast live destination.
Errors will be reported asynchronously and can be checked for with pollForErrorResponse()
or checkForErrorResponse()
.
srcRecordingId
- recording id which must exist in the source archive.dstRecordingId
- recording to extend in the destination, otherwise Aeron.NULL_VALUE
.stopPosition
- position to stop the replication. NULL_POSITION
to stop at end
of current recording.channelTagId
- used to tag the replication subscription.subscriptionTagId
- used to tag the replication subscription.srcControlStreamId
- remote control stream id for the source archive to instruct the replay on.srcControlChannel
- remote control channel for the source archive to instruct the replay on.liveDestination
- destination for the live stream if merge is required. Empty or null for no merge.replicationChannel
- channel over which the replication will occur. Empty or null for default channel.stopReplication(long)
.public long replicate(long srcRecordingId, int srcControlStreamId, String srcControlChannel, ReplicationParams replicationParams)
ReplicationParams
.
For a source recording that is still active the replay can merge with the live stream and then follow it directly and no longer require the replay from the source. This would require a multicast live destination.
Errors will be reported asynchronously and can be checked for with pollForErrorResponse()
or checkForErrorResponse()
.
The ReplicationParams is free to be reused when this call completes.
srcRecordingId
- recording id which must exist in the source archive.srcControlStreamId
- remote control stream id for the source archive to instruct the replay on.srcControlChannel
- remote control channel for the source archive to instruct the replay on.replicationParams
- Optional parameters to control the behaviour of the replication.stopReplication(long)
.public void stopReplication(long replicationId)
replicate(long, long, int, String, String)
.replicationId
- to stop replication for.replicate(long, long, int, String, String)
public boolean tryStopReplication(long replicationId)
replicate(long, long, int, String, String)
.replicationId
- to stop replication for.true
if the replication was stopped, false if the replication is not active.replicate(long, long, int, String, String)
public void detachSegments(long recordingId, long newStartPosition)
The new start position must be first byte position of a segment after the existing start position.
It is not possible to detach segments which are active for recording or being replayed.
recordingId
- to which the operation applies.newStartPosition
- for the recording after the segments are detached.segmentFileBasePosition(long, long, int, int)
public long deleteDetachedSegments(long recordingId)
recordingId
- to which the operation applies.detachSegments(long, long)
public long purgeSegments(long recordingId, long newStartPosition)
The new start position must be first byte position of a segment after the existing start position.
It is not possible to detach segments which are active for recording or being replayed.
recordingId
- to which the operation applies.newStartPosition
- for the recording after the segments are detached.detachSegments(long, long)
,
deleteDetachedSegments(long)
,
segmentFileBasePosition(long, long, int, int)
public long attachSegments(long recordingId)
Segment files must match the existing recording and join exactly to the start position of the recording they are being attached to.
recordingId
- to which the operation applies.detachSegments(long, long)
public long migrateSegments(long srcRecordingId, long dstRecordingId)
The source recording must match the destination recording for segment length, term length, mtu length, stream id. The source recording must join to the destination recording on a segment boundary and without gaps, i.e., the stop position and term id of one must match the start position and term id of the other.
The source recording must be stopped. The destination recording must be stopped if migrating segments to the end of the destination recording.
The source recording will be effectively truncated back to its start position after the migration.
srcRecordingId
- source recording from which the segments will be migrated.dstRecordingId
- destination recording to which the segments will be attached.Copyright © 2014-2022 Real Logic Limited. All Rights Reserved.