Class ArchiveProxy

java.lang.Object
io.aeron.archive.client.ArchiveProxy

public final class ArchiveProxy extends Object
Proxy class for encapsulating encoding and sending of control protocol messages to an archive.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Default number of retry attempts to be made when offering requests.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a proxy with a ExclusivePublication for sending control message requests.
    ArchiveProxy(ExclusivePublication publication, IdleStrategy retryIdleStrategy, NanoClock nanoClock, long connectTimeoutNs, int retryAttempts, CredentialsSupplier credentialsSupplier)
    Create a proxy with a ExclusivePublication for sending control message requests without specifying client details.
    ArchiveProxy(ExclusivePublication publication, IdleStrategy retryIdleStrategy, NanoClock nanoClock, long connectTimeoutNs, int retryAttempts, CredentialsSupplier credentialsSupplier, String clientInfo)
    Create a proxy with a ExclusivePublication for sending control message requests with specified client info.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use another constructor with an ExclusivePublication.
    ArchiveProxy(Publication publication, IdleStrategy retryIdleStrategy, NanoClock nanoClock, long connectTimeoutNs, int retryAttempts, CredentialsSupplier credentialsSupplier)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use another constructor with an ExclusivePublication.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    archiveId(long correlationId, long controlSessionId)
    Get the id of the Archive.
    boolean
    attachSegments(long recordingId, long correlationId, long controlSessionId)
    Attach segments to the beginning of a recording to restore history that was previously detached.
    boolean
    boundedReplay(long recordingId, long position, long length, int limitCounterId, String replayChannel, int replayStreamId, long correlationId, long controlSessionId)
    Replay a recording from a given position bounded by a position counter.
    boolean
    closeSession(long controlSessionId)
    Close this control session with the archive.
    boolean
    connect(String responseChannel, int responseStreamId, long correlationId)
    Connect to an archive on its control interface providing the response stream details.
    boolean
    deleteDetachedSegments(long recordingId, long correlationId, long controlSessionId)
    Delete segments which have been previously detached from a recording.
    boolean
    detachSegments(long recordingId, long newStartPosition, long correlationId, long controlSessionId)
    Detach segments from the beginning of a recording up to the provided new start position.
    boolean
    extendRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, boolean autoStop, long recordingId, long correlationId, long controlSessionId)
    Extend an existing, non-active, recorded stream for the same channel and stream id.
    boolean
    extendRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, long recordingId, long correlationId, long controlSessionId)
    Extend an existing, non-active, recorded stream for the same channel and stream id.
    boolean
    findLastMatchingRecording(long minRecordingId, String channelFragment, int streamId, int sessionId, long correlationId, long controlSessionId)
    Find the last recording that matches the given criteria.
    boolean
    getMaxRecordedPosition(long recordingId, long correlationId, long controlSessionId)
    Get the stop or active recorded position of a recording.
    boolean
    getRecordingPosition(long recordingId, long correlationId, long controlSessionId)
    Get the recorded position of an active recording.
    boolean
    getStartPosition(long recordingId, long correlationId, long controlSessionId)
    Get the start position of a recording.
    boolean
    getStopPosition(long recordingId, long correlationId, long controlSessionId)
    Get the stop position of a recording.
    boolean
    keepAlive(long controlSessionId, long correlationId)
    Keep this archive session alive by notifying the archive.
    boolean
    listRecording(long recordingId, long correlationId, long controlSessionId)
    List a recording descriptor for a given recording id.
    boolean
    listRecordings(long fromRecordingId, int recordCount, long correlationId, long controlSessionId)
    List a range of recording descriptors.
    boolean
    listRecordingsForUri(long fromRecordingId, int recordCount, String channelFragment, int streamId, long correlationId, long controlSessionId)
    List a range of recording descriptors which match a channel URI fragment and stream id.
    boolean
    listRecordingSubscriptions(int pseudoIndex, int subscriptionCount, String channelFragment, int streamId, boolean applyStreamId, long correlationId, long controlSessionId)
    List registered subscriptions in the archive which have been used to record streams.
    boolean
    migrateSegments(long srcRecordingId, long dstRecordingId, long correlationId, long controlSessionId)
    Migrate segments from a source recording and attach them to the beginning or end of a destination recording.
    Get the Publication used for sending control messages.
    boolean
    purgeRecording(long recordingId, long correlationId, long controlSessionId)
    Purge a stopped recording, i.e.
    boolean
    purgeSegments(long recordingId, long newStartPosition, long correlationId, long controlSessionId)
    Purge (detach and delete) segments from the beginning of a recording up to the provided new start position.
    boolean
    replay(long recordingId, long position, long length, String replayChannel, int replayStreamId, long correlationId, long controlSessionId)
    Replay a recording from a given position.
    boolean
    replay(long recordingId, String replayChannel, int replayStreamId, ReplayParams replayParams, long correlationId, long controlSessionId)
    Replay a recording from a given position.
    boolean
    replicate(long srcRecordingId, int srcControlStreamId, String srcControlChannel, ReplicationParams replicationParams, long correlationId, long controlSessionId)
    Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive.
    boolean
    replicate(long srcRecordingId, long dstRecordingId, int srcControlStreamId, String srcControlChannel, String liveDestination, long correlationId, long controlSessionId)
    Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive.
    boolean
    replicate(long srcRecordingId, long dstRecordingId, long stopPosition, int srcControlStreamId, String srcControlChannel, String liveDestination, String replicationChannel, long correlationId, long controlSessionId)
    Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive.
    boolean
    requestReplayToken(long lastCorrelationId, long controlSessionId, long recordingId)
    Request a token for this session that will allow a replay to be initiated from another image without re-authentication.
    boolean
    startRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, boolean autoStop, long correlationId, long controlSessionId)
    Start recording streams for a given channel and stream id pairing.
    boolean
    startRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, long correlationId, long controlSessionId)
    Start recording streams for a given channel and stream id pairing.
    boolean
    stopAllReplays(long recordingId, long correlationId, long controlSessionId)
    Stop any existing replay sessions for recording id or all replay sessions regardless of recording id.
    boolean
    stopRecording(long subscriptionId, long correlationId, long controlSessionId)
    Stop a recording by the Subscription.registrationId() it was registered with.
    boolean
    stopRecording(String channel, int streamId, long correlationId, long controlSessionId)
    Stop an active recording.
    boolean
    stopRecordingByIdentity(long recordingId, long correlationId, long controlSessionId)
    Stop an active recording by the recording id.
    boolean
    stopReplay(long replaySessionId, long correlationId, long controlSessionId)
    Stop an existing replay session.
    boolean
    stopReplication(long replicationId, long correlationId, long controlSessionId)
    Stop an active replication by the registration id it was registered with.
    boolean
    taggedReplicate(long srcRecordingId, long dstRecordingId, long channelTagId, long subscriptionTagId, int srcControlStreamId, String srcControlChannel, String liveDestination, long correlationId, long controlSessionId)
    Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive.
    boolean
    taggedReplicate(long srcRecordingId, long dstRecordingId, long stopPosition, long channelTagId, long subscriptionTagId, int srcControlStreamId, String srcControlChannel, String liveDestination, String replicationChannel, long correlationId, long controlSessionId)
    Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive.
    boolean
    truncateRecording(long recordingId, long position, long correlationId, long controlSessionId)
    Truncate a stopped recording to a given position that is less than the stopped position.
    boolean
    tryChallengeResponse(byte[] encodedCredentials, long correlationId, long controlSessionId)
    Try and send a ChallengeResponse to an archive on its control interface providing the credentials.
    boolean
    tryConnect(String responseChannel, int responseStreamId, long correlationId)
    Try and connect to an archive on its control interface providing the response stream details.
    boolean
    updateChannel(long recordingId, String channel, long correlationId, long controlSessionId)
    Update the channel for a recording.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • publication

      public Publication publication()
      Get the Publication used for sending control messages.
      Returns:
      the Publication used for sending control messages.
    • connect

      public boolean connect(String responseChannel, int responseStreamId, long correlationId)
      Connect to an archive on its control interface providing the response stream details.
      Parameters:
      responseChannel - for the control message responses.
      responseStreamId - for the control message responses.
      correlationId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • tryConnect

      public boolean tryConnect(String responseChannel, int responseStreamId, long correlationId)
      Try and connect to an archive on its control interface providing the response stream details. Only one attempt will be made to offer the request.
      Parameters:
      responseChannel - for the control message responses.
      responseStreamId - for the control message responses.
      correlationId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • keepAlive

      public boolean keepAlive(long controlSessionId, long correlationId)
      Keep this archive session alive by notifying the archive.
      Parameters:
      controlSessionId - with the archive.
      correlationId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • closeSession

      public boolean closeSession(long controlSessionId)
      Close this control session with the archive.
      Parameters:
      controlSessionId - with the archive.
      Returns:
      true if successfully offered otherwise false.
    • tryChallengeResponse

      public boolean tryChallengeResponse(byte[] encodedCredentials, long correlationId, long controlSessionId)
      Try and send a ChallengeResponse to an archive on its control interface providing the credentials. Only one attempt will be made to offer the request.
      Parameters:
      encodedCredentials - to send.
      correlationId - for this response.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • startRecording

      public boolean startRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, long correlationId, long controlSessionId)
      Start recording streams for a given channel and stream id pairing.
      Parameters:
      channel - to be recorded.
      streamId - to be recorded.
      sourceLocation - of the publication to be recorded.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • startRecording

      public boolean startRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, boolean autoStop, long correlationId, long controlSessionId)
      Start recording streams for a given channel and stream id pairing.
      Parameters:
      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.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • stopRecording

      public boolean stopRecording(String channel, int streamId, long correlationId, long controlSessionId)
      Stop an active recording.
      Parameters:
      channel - to be stopped.
      streamId - to be stopped.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • stopRecording

      public boolean stopRecording(long subscriptionId, long correlationId, long controlSessionId)
      Stop a recording by the Subscription.registrationId() it was registered with.
      Parameters:
      subscriptionId - that identifies the subscription in the archive doing the recording.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • stopRecordingByIdentity

      public boolean stopRecordingByIdentity(long recordingId, long correlationId, long controlSessionId)
      Stop an active recording by the recording id. This is not the Subscription.registrationId().
      Parameters:
      recordingId - that identifies a recording in the archive.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • replay

      public boolean replay(long recordingId, String replayChannel, int replayStreamId, ReplayParams replayParams, long correlationId, long controlSessionId)
      Replay a recording from a given position. Supports specifying ReplayParams to change the behaviour of the replay. For example a bounded replay can be requested by specifying the boundingLimitCounterId. The ReplayParams is free to be reused after this call completes.
      Parameters:
      recordingId - to be replayed.
      replayChannel - to which the replay should be sent.
      replayStreamId - to which the replay should be sent.
      replayParams - optional parameters change the behaviour of the replay.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
      See Also:
    • replay

      public boolean replay(long recordingId, long position, long length, String replayChannel, int replayStreamId, long correlationId, long controlSessionId)
      Replay a recording from a given position.
      Parameters:
      recordingId - to be replayed.
      position - from which the replay should be started.
      length - of the stream to be replayed. Use Long.MAX_VALUE to follow a live stream.
      replayChannel - to which the replay should be sent.
      replayStreamId - to which the replay should be sent.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • boundedReplay

      public boolean boundedReplay(long recordingId, long position, long length, int limitCounterId, String replayChannel, int replayStreamId, long correlationId, long controlSessionId)
      Replay a recording from a given position bounded by a position counter.
      Parameters:
      recordingId - to be replayed.
      position - from which the replay should be started.
      length - of the stream to be replayed. Use Long.MAX_VALUE to follow a live stream.
      limitCounterId - to use as the replay bound.
      replayChannel - to which the replay should be sent.
      replayStreamId - to which the replay should be sent.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • stopReplay

      public boolean stopReplay(long replaySessionId, long correlationId, long controlSessionId)
      Stop an existing replay session.
      Parameters:
      replaySessionId - that should be stopped.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • stopAllReplays

      public boolean stopAllReplays(long recordingId, long correlationId, long controlSessionId)
      Stop any existing replay sessions for recording id or all replay sessions regardless of recording id.
      Parameters:
      recordingId - that should be stopped.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • listRecordings

      public boolean listRecordings(long fromRecordingId, int recordCount, long correlationId, long controlSessionId)
      List a range of recording descriptors.
      Parameters:
      fromRecordingId - at which to begin listing.
      recordCount - for the number of descriptors to be listed.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • listRecordingsForUri

      public boolean listRecordingsForUri(long fromRecordingId, int recordCount, String channelFragment, int streamId, long correlationId, long controlSessionId)
      List a range of recording descriptors which match a channel URI fragment and stream id.
      Parameters:
      fromRecordingId - at which to begin listing.
      recordCount - for the number of descriptors to be listed.
      channelFragment - to match recordings on from the original channel URI in the archive descriptor.
      streamId - to match recordings on.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • listRecording

      public boolean listRecording(long recordingId, long correlationId, long controlSessionId)
      List a recording descriptor for a given recording id.
      Parameters:
      recordingId - at which to begin listing.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • extendRecording

      public boolean extendRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, long recordingId, long correlationId, long controlSessionId)
      Extend an existing, non-active, recorded stream for the same channel and stream id.

      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, long, long).

      Parameters:
      channel - to be recorded.
      streamId - to be recorded.
      sourceLocation - of the publication to be recorded.
      recordingId - to be extended.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • extendRecording

      public boolean extendRecording(String channel, int streamId, io.aeron.archive.codecs.SourceLocation sourceLocation, boolean autoStop, long recordingId, long correlationId, long controlSessionId)
      Extend an existing, non-active, recorded stream for the same channel and stream id.

      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, long, long).

      Parameters:
      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.
      recordingId - to be extended.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • getRecordingPosition

      public boolean getRecordingPosition(long recordingId, long correlationId, long controlSessionId)
      Get the recorded position of an active recording.
      Parameters:
      recordingId - of the active recording that the position is being requested for.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • truncateRecording

      public boolean truncateRecording(long recordingId, long position, long correlationId, long controlSessionId)
      Truncate a stopped recording to a given position that is less than the stopped position. The provided position must be on a fragment boundary. Truncating a recording to the start position effectively deletes the recording.
      Parameters:
      recordingId - of the stopped recording to be truncated.
      position - to which the recording will be truncated.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • purgeRecording

      public boolean purgeRecording(long recordingId, long correlationId, long controlSessionId)
      Purge a stopped recording, i.e. mark recording as RecordingState.INVALID and delete the corresponding segment files. The space in the Catalog will be reclaimed upon compaction.
      Parameters:
      recordingId - of the stopped recording to be purged.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • getStartPosition

      public boolean getStartPosition(long recordingId, long correlationId, long controlSessionId)
      Get the start position of a recording.
      Parameters:
      recordingId - of the recording that the position is being requested for.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • getStopPosition

      public boolean getStopPosition(long recordingId, long correlationId, long controlSessionId)
      Get the stop position of a recording.
      Parameters:
      recordingId - of the recording that the stop position is being requested for.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • getMaxRecordedPosition

      public boolean getMaxRecordedPosition(long recordingId, long correlationId, long controlSessionId)
      Get the stop or active recorded position of a recording.
      Parameters:
      recordingId - of the recording that the stop of active recording position is being requested for.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • archiveId

      public boolean archiveId(long correlationId, long controlSessionId)
      Get the id of the Archive.
      Parameters:
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • findLastMatchingRecording

      public boolean findLastMatchingRecording(long minRecordingId, String channelFragment, int streamId, int sessionId, long correlationId, long controlSessionId)
      Find the last recording that matches the given criteria.
      Parameters:
      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.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • listRecordingSubscriptions

      public boolean listRecordingSubscriptions(int pseudoIndex, int subscriptionCount, String channelFragment, int streamId, boolean applyStreamId, long correlationId, long controlSessionId)
      List registered subscriptions in the archive which have been used to record streams.
      Parameters:
      pseudoIndex - in the list of active recording subscriptions.
      subscriptionCount - for the number of descriptors to be listed.
      channelFragment - for a contains match on the stripped channel used with the registered subscription.
      streamId - for the subscription.
      applyStreamId - when matching.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • replicate

      public boolean replicate(long srcRecordingId, long dstRecordingId, int srcControlStreamId, String srcControlChannel, String liveDestination, long correlationId, long controlSessionId)
      Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive. The source recording will be replayed via the provided replay channel and use the original stream id. If the destination recording id is 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 AeronArchive.pollForErrorResponse() or AeronArchive.checkForErrorResponse().

      Parameters:
      srcRecordingId - recording id which must exist in the source archive.
      dstRecordingId - recording to extend in the destination, otherwise Aeron.NULL_VALUE.
      srcControlChannel - remote control channel for the source archive to instruct the replay on.
      srcControlStreamId - remote control stream id 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.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • replicate

      public boolean replicate(long srcRecordingId, long dstRecordingId, long stopPosition, int srcControlStreamId, String srcControlChannel, String liveDestination, String replicationChannel, long correlationId, long controlSessionId)
      Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive. The source recording will be replayed via the provided replay channel and use the original stream id. If the destination recording id is 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 AeronArchive.pollForErrorResponse() or AeronArchive.checkForErrorResponse().

      Parameters:
      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. AeronArchive.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.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • taggedReplicate

      public boolean taggedReplicate(long srcRecordingId, long dstRecordingId, long channelTagId, long subscriptionTagId, int srcControlStreamId, String srcControlChannel, String liveDestination, long correlationId, long controlSessionId)
      Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive. The source recording will be replayed via the provided replay channel and use the original stream id. If the destination recording id is 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 AeronArchive.pollForErrorResponse() or AeronArchive.checkForErrorResponse().

      Parameters:
      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.
      srcControlChannel - remote control channel for the source archive to instruct the replay on.
      srcControlStreamId - remote control stream id 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.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • taggedReplicate

      public boolean taggedReplicate(long srcRecordingId, long dstRecordingId, long stopPosition, long channelTagId, long subscriptionTagId, int srcControlStreamId, String srcControlChannel, String liveDestination, String replicationChannel, long correlationId, long controlSessionId)
      Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive. The source recording will be replayed via the provided replay channel and use the original stream id. If the destination recording id is 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 AeronArchive.pollForErrorResponse() or AeronArchive.checkForErrorResponse().

      Parameters:
      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. AeronArchive.NULL_POSITION to stop at end of current recording.
      channelTagId - used to tag the replication subscription.
      subscriptionTagId - used to tag the replication subscription.
      srcControlChannel - remote control channel for the source archive to instruct the replay on.
      srcControlStreamId - remote control stream id 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.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • replicate

      public boolean replicate(long srcRecordingId, int srcControlStreamId, String srcControlChannel, ReplicationParams replicationParams, long correlationId, long controlSessionId)
      Replicate a recording from a source archive to a destination which can be considered a backup for a primary archive. The behaviour of the replication is controlled through the 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 AeronArchive.pollForErrorResponse() or AeronArchive.checkForErrorResponse().

      The ReplicationParams is free to be reused when this call completes.

      Parameters:
      srcRecordingId - recording id which must exist in the source archive.
      srcControlChannel - remote control channel for the source archive to instruct the replay on.
      srcControlStreamId - remote control stream id for the source archive to instruct the replay on.
      replicationParams - optional parameters to control the behaviour of the replication.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
      See Also:
    • stopReplication

      public boolean stopReplication(long replicationId, long correlationId, long controlSessionId)
      Stop an active replication by the registration id it was registered with.
      Parameters:
      replicationId - that identifies the session in the archive doing the replication.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • detachSegments

      public boolean detachSegments(long recordingId, long newStartPosition, long correlationId, long controlSessionId)
      Detach segments from the beginning of a recording up to the provided new start position.

      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.

      Parameters:
      recordingId - to which the operation applies.
      newStartPosition - for the recording after the segments are detached.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
      See Also:
    • deleteDetachedSegments

      public boolean deleteDetachedSegments(long recordingId, long correlationId, long controlSessionId)
      Delete segments which have been previously detached from a recording.
      Parameters:
      recordingId - to which the operation applies.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
      See Also:
    • purgeSegments

      public boolean purgeSegments(long recordingId, long newStartPosition, long correlationId, long controlSessionId)
      Purge (detach and delete) segments from the beginning of a recording up to the provided new start position.

      The new start position must be first byte position of a segment after the existing start position.

      It is not possible to purge segments which are active for recording or being replayed.

      Parameters:
      recordingId - to which the operation applies.
      newStartPosition - for the recording after the segments are detached.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
      See Also:
    • attachSegments

      public boolean attachSegments(long recordingId, long correlationId, long controlSessionId)
      Attach segments to the beginning of a recording to restore history that was previously detached.

      Segment files must match the existing recording and join exactly to the start position of the recording they are being attached to.

      Parameters:
      recordingId - to which the operation applies.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
      See Also:
    • migrateSegments

      public boolean migrateSegments(long srcRecordingId, long dstRecordingId, long correlationId, long controlSessionId)
      Migrate segments from a source recording and attach them to the beginning or end of a destination recording.

      The source recording must match the destination recording for segment length, term length, mtu length, and 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.

      Parameters:
      srcRecordingId - source recording from which the segments will be migrated.
      dstRecordingId - destination recording to which the segments will be attached.
      correlationId - for this request.
      controlSessionId - for this request.
      Returns:
      true if successfully offered otherwise false.
    • requestReplayToken

      public boolean requestReplayToken(long lastCorrelationId, long controlSessionId, long recordingId)
      Request a token for this session that will allow a replay to be initiated from another image without re-authentication.
      Parameters:
      lastCorrelationId - for the request
      controlSessionId - for the request
      recordingId - that will be replayed.
      Returns:
      true if successfully offered
    • updateChannel

      public boolean updateChannel(long recordingId, String channel, long correlationId, long controlSessionId)
      Update the channel for a recording.
      Parameters:
      recordingId - the recording id to update.
      channel - the new channel to include in the catalogue.
      correlationId - for the request.
      controlSessionId - for the request.
      Returns:
      true if successfully offered.