aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java
public Subscription replay(
        final long recordingId,
        final long position,
        final long length,
        final String replayChannel,
        final int replayStreamId)
    {
        lock.lock();
        try
        {
            ensureOpen();

            final ChannelUri replayChannelUri = ChannelUri.parse(replayChannel);
            final long correlationId = aeron.nextCorrelationId();

            if (!archiveProxy.replay(
                recordingId,
                position,
                length,
                replayChannel,
                replayStreamId,
                correlationId,
                controlSessionId))
            {
                throw new ArchiveException("failed to send replay request");
            }

            final int replaySessionId = (int)pollForResponse(correlationId);
            replayChannelUri.put(CommonContext.SESSION_ID_PARAM_NAME, Integer.toString(replaySessionId));

            return aeron.addSubscription(replayChannelUri.toString(), replayStreamId);
        }
        finally
        {
            lock.unlock();
        }
    }
public Subscription replay(
        final long recordingId,
        final long position,
        final long length,
        final String replayChannel,
        final int replayStreamId)
    {
        lock.lock();
        try
        {
            ensureOpen();

            final ChannelUri replayChannelUri = ChannelUri.parse(replayChannel);
            final long correlationId = aeron.nextCorrelationId();

            if (!archiveProxy.replay(
                recordingId,
                position,
                length,
                replayChannel,
                replayStreamId,
                correlationId,
                controlSessionId))
            {
                throw new ArchiveException("failed to send replay request");
            }

            final int replaySessionId = (int)pollForResponse(correlationId);
            replayChannelUri.put(CommonContext.SESSION_ID_PARAM_NAME, Integer.toString(replaySessionId));

            return aeron.addSubscription(replayChannelUri.toString(), replayStreamId);
        }
        finally
        {
            lock.unlock();
        }
    }
Replay a length in bytes of a recording from a position and for convenience create a {@link Subscription}
to receive the replay. If the position is {@link #NULL_POSITION} then the stream will be replayed from the start.

@param recordingId    to be replayed.
@param position       from which the replay should begin or {@link #NULL_POSITION} if from the start.
@param length         of the stream to be replayed or {@link Long#MAX_VALUE} to follow a live recording.
@param replayChannel  to which the replay should be sent.
@param replayStreamId to which the replay should be sent.
@return the {@link Subscription} for consuming the replay.