Page History
...
The Enterprise Replay Service allows a client to replay messages from any of their venue sessions.
Messages are available for replay immediately after they are sent to or from the original userthe client.
The current week's messages are available for replay. If you reset sequence numbers during the week, you will need to use a time-based query to replay messages from before the reset. It is possible, depending on the nature of the sequence number reset, that after thereset messages will not be available for replay.
| Note |
|---|
|
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
logonEncoder
.venuename("client_replay")
.username("testuser")
.password("user1password")
.nextExpectedMsgSeqNum(1)
.heartBtInt((short) 30)
.sessionType(SessionType.Replay)
.text(""); |
Replay Protocol Summary
After a successful logon
1) After logon, submit Submit an ApplicationMessageRequest to start the replay.
...
3) Receive 1 ApplicationMessageReport message at the end of the replay. Every request will be terminated with an ApplicationMessageReport.
4) To start another replay, stay connected and repeat steps 1-4 above; or disconnect.
| Note |
|---|
|
| ApplicationMessageRequest Field Notes. Does not cover all fields - refer to the SBE schema for other notes. | ||
|---|---|---|
Field | Comments | Example |
RefApplID | Gateway service name with type to replay message for. Format - venue_name.session_type. | lmax.maker.exchange.Orders |
ApplMessageTypes | Replays original messages with a type matching one of the provided values. Note: Only 'ExecutionReport' is supported and must be included in this field. Any other requested message types will be ignored. | .applMessageTypes().clear().executionReport(true) |
ApplBegSeqNum | Replays original messages with a seqNum greater than or equal to this value. If provided, the ApplEndSeqNum must also be provided. Must be less than the the ApplEndSeqNum. Inclusive. | 352 |
ApplEndSeqNum | Replays original messages with a seqNum less than or equal to this value. If provided, the ApplBegSeqNum must also be provided. Must be greater than the ApplBegSeqNum. Inclusive. | 400 |
ApplStartTime | Replays original messages with a sendingTime greater than or equal to this value. If provided, the ApplEndTime must also be provided. Must be before the less than ApplEndTime. Epoch nanos. | 1625718249000000000 |
ApplEndTime | Replays original messages with a sendingTime less than or equal to this value. If provided, the ApplStartTime must must also be provided. Must be after the greater than ApplStartTime. Epoch nanos. | 1625718259000000000 |
...
| applBegSeqNum | applEndSeqNum | applStartTime | applEndTime | Query |
|---|---|---|---|---|
| Set | Set | Null | Null | Replay all Execution Reports with sequence numbers equal to and between the provided sequence numbers. |
| Null | Null | Set | Set | Replay all Execution Reports between the provided start and end times. |
| Set | Set | Set | Set | Replay all Execution Reports between both the time and sequence numbers. |
Example ApplicationMessageRequest to start a sequence number based replay.| Code Block | ||||
|---|---|---|---|---|
| ||||
applicationMessageRequestEncoder
.applReqID(System.currentTimeMillis())
.applReqType(ApplReqType.StartRetransmission);
final var noApplIDsEncoder = applicationMessageRequestEncoder.noApplIDsCount(1);
noApplIDsEncoder.next();
noApplIDsEncoder
.refApplID("fidessa_orders.Orders")
.applUsername("Test")
.applMessageTypes().clear().executionReport(true);
noApplIDsEncoder.applBegSeqNum(1);
noApplIDsEncoder.applEndSeqNum(10000);
noApplIDsEncoder.applStartTime(ApplicationMessageRequestEncoder.NoApplIDsEncoder.applStartTimeNullValue());
noApplIDsEncoder.applEndTime(ApplicationMessageRequestEncoder.NoApplIDsEncoder.applEndTimeNullValue());
|
Example decoding original message in ReplayedMessage - Not Safe for Production
| Code Block | ||
|---|---|---|
| ||
public void onReplayedMessage(MessageHeaderDecoder messageHeader, ReplayedMessageDecoder replayedMessage) { LOG.info(format("[Replay] Received replayed message [%s %s]", messageHeader, replayedMessage)); final ByteBuffer rawBuffer = ByteBuffer.allocateDirect(16000); final UnsafeBuffer raw = new UnsafeBuffer(rawBuffer); replayedMessage.getRawMessage(raw, 0, replayedMessage.rawMessageLength()); final MessageHeaderDecoder header = new MessageHeaderDecoder().wrap(raw, 0); final int msgId = header.templateId(); switch (msgId) { case ExecutionReportDecoder.TEMPLATE_ID: { final ExecutionReportDecoder erd = new ExecutionReportDecoder().wrap(raw, header.encodedLength(), ExecutionReportDecoder.BLOCK_LENGTH, ExecutionReportDecoder.SCHEMA_VERSION); System.out.println(erd); break; } default: { System.out.println("Unhandled message: " + msgId); } } |