LastMsgSeqNumProcessed(369) tag represents last MsgSeqNum(34) value received by the FIX engine and processed by the downstream application, such as trading engine or order routing system.
It can be specified on every message sent. It is useful for detecting a backlog with a counterparty.
The changes were introduced into FIX Antenna Java to support LastMsgSeqNumProcessed(369) tag processing. Improved mechanism of User Message handlers gives customers a flexible way to write and register own handlers for specific cases.
Sending LastMsgSeqNumProcessed(369) tag with FIX Antenna Java
FIX Antenna Java provides a built-in way to fill LastMsgSeqNumProcessed(369) tag for all outgoing messages. It needs to switch on the option ‘includeLastProcessed’ in FIX session configuration to enable this feature:
Processing LastMsgSeqNumProcessed(369) tag
FIX Antenna Java provides a mechanism for extending engine’ message processing logic – user message handlers. It allows customizing engine’ behavior to different environments. This way also allows implementing processing of LastMsgSeqNumProcessed(369) tag for all incoming messages.
User Message handlers
User Message handlers register in FIX engine’ handlers chain to process all incoming messages. User Message handlers are placed in the chain before typed System Session message handlers but after Global System message handlers.
There 2 ways to register User Message handler:
- via engine/session configuration file
- with new API
Define User Message handler in configuration
To register User Message handler it needs to specify following lines in "fixengine.properties" file:
This approach is simple but does not give enough flexibility and doesn’t allow to link handler with the rest application.
Register User Message handler with new API
New API (started from 2.21.0) can be used to register user message handler via code:
User Message handler classes need to be extended from new AbstractUserGlobalMessageHandler class and implement processMessage(FIXFieldList message) method for user logic:
This approach is more flexible and allows creating handlers with initial parameters or dynamically links them with other application parts.
Tag 369 processing with User Message handler mechanism
FIX Antenna Java provides implementations for pair of LastMsgSeqNumProcessed(369) tag processing cases:
- automatic sequence synchronization on Logout message by LastMsgSeqNumProcessed(369) tag
- slow consumer detection based on LastMsgSeqNumProcessed(369) tag values
Automatic sequence synchronization on Logout
Following sample can be used to synchronize sequences based on LastMsgSeqNumProcessed(369) tag value in Logout with User Message handler. Implementation of LastProcessedSequenceSyncMessageHandler is available started from FIX Antenna Java 2.21.0:
This handler can be registered through:
Slow consumer detection based on LastMsgSeqNumProcessed(369) tag values
Following sample can be used to check and detect slow consumer case based on LastMsgSeqNumProcessed(369) tag processing. Provided LastProcessedSlowConsumerCheckerMessageHandler compare session’ outgoing sequence number with received LastMsgSeqNumProcessed(369) tag value and report about a slow consumer in case of exceeding the provided threshold:
LastProcessedSlowConsumerCheckerMessageHandlern is also available started from FIX Antenna Java 2.21.0.
To enable this logic you need to create handler and register it with API: