简体   繁体   中英

Sequence validator: Is there anyway to validate sequence number MSH:13 whether it is valid in sequence with current sequence number or not?

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 eg 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 to globalChannelMap.get('lastSeqNo') and decide to reject or filter the message.

Be aware of:

  • javascript types (you want to compare numbers not strings)
  • initializing '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' is null
  • what to do if the sender resets its own sequence number. Will this value increase forever or might the sender some day reset it to zero?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM