public final class RecordingReplicator extends Object
RecordingReplicator allows replicating a recording from the source Archive to the destination Archive either
as a new recording or by replacing an existing recording.
Note: If DESTINATION_RECORDING_ID_PROP_NAME is set then the existing destination recording will
be completely replaced, i.e. truncated and overwritten with the data from the source recording.
Configuration properties:
SOURCE_RECORDING_ID_PROP_NAME - required, specifies id of source recording to be replicated.DESTINATION_RECORDING_ID_PROP_NAME - optional, specifies id of destination recording to be
replaced. If omitted or set to Aeron.NULL_VALUE then the new recording will be created in the destination
Archive.SOURCE_ARCHIVE_CONTROL_REQUEST_CHANNEL - required, specifies the control request channel of the
source Archive. Must be reachable from the destination Archive.SOURCE_ARCHIVE_CONTROL_REQUEST_STREAM_ID - optional, specifies the control request stream id for
connecting to the source Archive from the destination Archive. Defaults to
AeronArchive.Configuration.CONTROL_STREAM_ID_DEFAULTREPLICATION_CHANNEL - optional, specifies the replication channel to be used for the replication of
the source recording. When non-empty overrides the Archive.Context.replicationChannel()
of the destination Archive, otherwise the latter is used.CommonContext.AERON_DIR_PROP_NAME - optional, specifies the aeron directory for connecting
to the MediaDriver. If not specified the the default Aeron directory is assumed
(CommonContext.AERON_DIR_PROP_DEFAULT).AeronArchive.Configuration.CONTROL_CHANNEL_PROP_NAME - required, specifies
control request channel for connecting to the destination Archive.AeronArchive.Configuration.CONTROL_STREAM_ID_PROP_NAME - optional, specifies
control request stream id for connecting to the destination Archive. Defaults to
AeronArchive.Configuration.CONTROL_STREAM_ID_DEFAULT.
AeronArchive.Configuration.CONTROL_RESPONSE_CHANNEL_PROP_NAME - required,
specifies control response channel for receiving responses from the destination Archive.AeronArchive.Configuration.CONTROL_RESPONSE_STREAM_ID_PROP_NAME - optional,
specifies control response stream id for receiving responses from the destination Archive. Defaults to
AeronArchive.Configuration.CONTROL_RESPONSE_STREAM_ID_DEFAULT.The easiest way is to pass the configuration via file, e.g.:
java -cp ... io.aeron.samples.Archive.RecordingReplicator <prop file name>
An alternative is to pass properties using the -D JVM flag, e.g.:
java -cp ... -Daeron.dir=some-dir ... io.aeron.samples.Archive.RecordingReplicator
| Modifier and Type | Field and Description |
|---|---|
static String |
DESTINATION_RECORDING_ID_PROP_NAME
Name of the optional system property for specifying the destination recording id.
|
static String |
REPLICATION_CHANNEL
Name of the optional system property for specifying an explicit replication channel for recording replication
between source and destination archives.
|
static String |
SOURCE_ARCHIVE_CONTROL_REQUEST_CHANNEL
Name of the required system property for specifying the control request channel to connect to the source Archive
from the destination Archive.
|
static String |
SOURCE_ARCHIVE_CONTROL_REQUEST_STREAM_ID
Name of the optional system property for specifying the control request stream id to connect to the source
Archive from the destination Archive.
|
static String |
SOURCE_RECORDING_ID_PROP_NAME
Name of the required system property for specifying the id of the source recording that must be replicated to
the destination Archive.
|
| Constructor and Description |
|---|
RecordingReplicator(AeronArchive aeronArchive,
long srcRecordingId,
long dstRecordingId,
String srcArchiveRequestChannel,
int srcArchiveRequestStreamId,
String replicationChannel) |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Main method for launching the process.
|
long |
replicate()
Replicate source recording to the destination Archive.
|
public static final String SOURCE_RECORDING_ID_PROP_NAME
public static final String DESTINATION_RECORDING_ID_PROP_NAME
Aeron.NULL_VALUE in which case the source recording will be replicated as a new recording in
the destination Archive.public static final String SOURCE_ARCHIVE_CONTROL_REQUEST_CHANNEL
public static final String SOURCE_ARCHIVE_CONTROL_REQUEST_STREAM_ID
AeronArchive.Configuration.CONTROL_STREAM_ID_DEFAULT.public static final String REPLICATION_CHANNEL
Archive.Context.replicationChannel() of the destination Archive will be used.public RecordingReplicator(AeronArchive aeronArchive, long srcRecordingId, long dstRecordingId, String srcArchiveRequestChannel, int srcArchiveRequestStreamId, String replicationChannel)
aeronArchive - client for the destination Archive.srcRecordingId - id of the recording from the source Archive that must be replicated.dstRecordingId - id of existing recording in the destination Archive that must be
replaced. If set as Aeron.NULL_VALUE in which case a new recording
will be created.srcArchiveRequestChannel - request channel for sending commands to the source Archive.srcArchiveRequestStreamId - request stream id for sending commands to the source Archive.replicationChannel - override the channel via which the recording data is replicated between
the source and destination Archives. If null or empty then the
Archive.Context.replicationChannel() of the
destination Archive will be used.NullPointerException - if any of the required properties are not set.IllegalArgumentException - if AeronArchive.Context.recordingSignalConsumer()
is not set.ClassCastException - if AeronArchive.Context.recordingSignalConsumer()
is not an instance of the RecordingSignalCapture class.public long replicate()
public static void main(String[] args)
args - passed to the process.Copyright © 2014-2023 Real Logic Limited. All Rights Reserved.