Search code examples
mirth

Is there anyway to check duplicate the message control id (MSH:10) in MSH segment using Mirth connect?


Is there anyway to check duplicate the message control id (MSH:10) in MSH segment using Mirth connect?

MSH|^~&|sss|xxx|INSTANCE2|KKLIU 0063/2021|20190905162034||ADT^A28^ADT_A05|Zx20190905162034|P|2.4|||NE|NE|||||

whenever message enters it needs to be validated whether duplicate of control id Zx20190905162034 is already processed or not?


Solution

  • The database check (you can implement this using code template) is the easier way out. You might want to designate the column storing MSH:10 values as a primary key or define an index on it. Queries against unique entries would be faster. Other alternatives include periodically redeploying the Channel while reading all MSH:10 values already in the database and placing them in a global map variable or maintained in an API that you can make a GET request to when processing every message. Any of the options depends on the number of records we are speaking about.