In Mirth Connect, Is there anyway to validate sequence number MSH:13 whether it is valid number in sequence with current sequence number or not ?
For e.g. if Previously processed message sequence no MSH:13 is 102.
Then current incoming message sequence no MSH:13 should be 103.
If it is not 103 then validator should reject the message.
I assume your messages are processing sequentially. In Mirth Connect that means a single-threaded source connector and a single-threaded destination connector (or a destination connector with a thread-assignment-variable set to your message sequence id).
You can set a
globalChannelMap
variable with your sequence number.globalChannelMap.put('lastSeqNo', msg['MSH']['MSH.13'])
. Then you can simply compare your current sequence number toglobalChannelMap.get('lastSeqNo')
and decide to reject or filter the message.Be aware of:
'lastSeqNo'
to zero if it is not already set (as when a channel is deployed with "clear global channel map" selected) OR ensuring that your comparison handles the case when'lastSeqNo'
isnull