public final class ReplayMerge extends Object implements AutoCloseable
Once constructed either of poll(FragmentHandler, int) or doWork(), interleaved with consumption
of the image(), should be called in a duty cycle loop until isMerged() is true.
After which the ReplayMerge can be closed and continued usage can be made of the Image or its
parent Subscription. If an exception occurs or progress stops, the merge will fail and
hasFailed() will be true.
If the endpoint on the replay destination uses a port of 0, then the OS will assign a port from the ephemeral range and this will be added to the replay channel for instructing the archive.
NOTE: Merging is only supported with UDP streams.
| Modifier and Type | Field and Description |
|---|---|
static int |
LIVE_ADD_MAX_WINDOW
The maximum window at which a live destination should be added when trying to merge.
|
| Constructor and Description |
|---|
ReplayMerge(Subscription subscription,
AeronArchive archive,
String replayChannel,
String replayDestination,
String liveDestination,
long recordingId,
long startPosition)
Create a
ReplayMerge to manage the merging of a replayed stream and switching over to live stream as
appropriate. |
ReplayMerge(Subscription subscription,
AeronArchive archive,
String replayChannel,
String replayDestination,
String liveDestination,
long recordingId,
long startPosition,
EpochClock epochClock,
long mergeProgressTimeoutMs)
Create a
ReplayMerge to manage the merging of a replayed stream and switching over to live stream as
appropriate. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close and stop any active replay.
|
int |
doWork()
Perform the work of replaying and merging.
|
boolean |
hasFailed()
Has the replay merge failed due to an error?
|
Image |
image()
The
Image which is a merge of the replay and live stream. |
boolean |
isLiveAdded()
Is the live destination added to the
subscription()? |
boolean |
isMerged()
Is the live stream merged and the replay stopped?
|
int |
poll(FragmentHandler fragmentHandler,
int fragmentLimit)
Poll the
Image used for replay and merging and live stream. |
Subscription |
subscription()
Get the
Subscription used to consume the replayed and merged stream. |
String |
toString() |
public static final int LIVE_ADD_MAX_WINDOW
public ReplayMerge(Subscription subscription, AeronArchive archive, String replayChannel, String replayDestination, String liveDestination, long recordingId, long startPosition, EpochClock epochClock, long mergeProgressTimeoutMs)
ReplayMerge to manage the merging of a replayed stream and switching over to live stream as
appropriate.subscription - to use for the replay and live stream. Must be a multi-destination subscription.archive - to use for the replay.replayChannel - to as a template for the what the archive will use.replayDestination - to send the replay to and the destination added by the Subscription.liveDestination - for the live stream and the destination added by the Subscription.recordingId - for the replay.startPosition - for the replay.epochClock - to use for progress checks.mergeProgressTimeoutMs - to use for progress checks.public ReplayMerge(Subscription subscription, AeronArchive archive, String replayChannel, String replayDestination, String liveDestination, long recordingId, long startPosition)
ReplayMerge to manage the merging of a replayed stream and switching over to live stream as
appropriate.subscription - to use for the replay and live stream. Must be a multi-destination subscription.archive - to use for the replay.replayChannel - to use as a template for the what the archive will use.replayDestination - to send the replay to and the destination added by the Subscription.liveDestination - for the live stream and the destination added by the Subscription.recordingId - for the replay.startPosition - for the replay.public void close()
close in interface AutoCloseablepublic Subscription subscription()
Subscription used to consume the replayed and merged stream.Subscription used to consume the replayed and merged stream.public int doWork()
Image directly,
call poll(FragmentHandler, int) on this class.public int poll(FragmentHandler fragmentHandler, int fragmentLimit)
Image used for replay and merging and live stream. The doWork() method
will be called before the poll so that processing of the merge can be done.fragmentHandler - to call for fragments.fragmentLimit - for poll call.public boolean isMerged()
public boolean hasFailed()
public Image image()
Image which is a merge of the replay and live stream.Image which is a merge of the replay and live stream.public boolean isLiveAdded()
subscription()?Copyright © 2014-2020 Real Logic Limited. All Rights Reserved.