Announcement

Collapse
No announcement yet.

MIrth with sequential data flow

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MIrth with sequential data flow

    Mirth version 3.5.2

    I am connecting to an Application which has multiple sequential workflows. The app communicates using TCP connection with the XML data format

    1. App sends Hello message to Mirth
    2. Mirth send ACK for Hello
    3. App sends a validation message to Mirth
    4. Mirth send ACK for validation message
    5. App sends data in XML format.
    6. Mirth sends ACK for data.
    7. App sends end of the data message to mirth.
    8. App sends a disconnect request message to mirth
    9. Mirth sends an ack for the disconnect request message.
    10. App sends the final ACK to Mirth.

    I captured message ID in source tranformer, check the message type based on the xml tag put this values into globalchannel map and used that in post process to create custom ack. The post-process have custom ack based on each message type but it's not working correctly. Once app sends hello mirth is not sending hello ack and the app is timing out.

    Below is my code in post process

    Code:
    var msg = globalChannelMap.get('rawMsg');
    var curdate = DateUtil.getCurrentDate('yyyy-MM-dd');
    var curdate = DateUtil.getCurrentDate('HH:mm:ss.SS');
    var fulcurdatetime = curdate +"T"+curdate+"-04:00";
    var controllerID = globalChannelMap.get('XMLControlID');
    var HELdeteceted = globalChannelMap.get('HEL');
    var DSTdeteceted = globalChannelMap.get('DST');
    var OBSdeteceted = globalChannelMap.get('OBS');
    var ENDdeteceted = globalChannelMap.get('END');
    
    var ackHEL = '<ACK.R01><HDR><HDR.message_type V="ACK.R01" /><HDR.control_id V="1" /><HDR.version_id V="" /><HDR.creation_dttm V="' + fulcurdatetime +'" /></HDR><ACK><ACK.type_cd V="AA" DN="" /><ACK.ack_control_id V="'+ controllerID+ '" /></ACK></ACK.R01>';
    var ackDST = '<ACK.R01><HDR><HDR.message_type V="ACK.R01" /><HDR.control_id V="2" /><HDR.version_id V="" /><HDR.creation_dttm V="' + fulcurdatetime +'" /></HDR><ACK><ACK.type_cd V="AA" DN="" /><ACK.ack_control_id V="'+ controllerID+ '" /></ACK></ACK.R01>';
    var ackOBS = '<ACK.R01><HDR><HDR.message_type V="ACK.R01" /><HDR.control_id V="4" /><HDR.version_id V="" /><HDR.creation_dttm V="' + fulcurdatetime +'" /></HDR><ACK><ACK.type_cd V="AA" DN="" /><ACK.ack_control_id V="'+ controllerID+ '" /></ACK></ACK.R01>';
    //var ackEND = '<END.R01><HDR><HDR.message_type V="END.R01" /><HDR.control_id V="5" /><HDR.version_id V="" /><HDR.creation_dttm V="' + fulcurdatetime +'" /></HDR><TRM><TRM.reason_cd V="NRM" /></TRM></END.R01>';
    
    if ( HELdeteceted == 'yes')
    	{
    	responseMap.put('ACK', ackHEL);
    	}
    
    if ( DSTdeteceted == 'yes')
    	{
    	responseMap.put('ACK', ackDST);
    	}
    
    if ( OBSdeteceted == 'yes')
    	{
    	responseMap.put('ACK', ackOBS);
    	}
    
    if ( ENDdeteceted == 'yes')
    	{
    	responseMap.put('ACK', ackEND);
    	}
    
    return;

  • #2
    What you're attempting is difficult in mirth. A potential problem that I see right away is that you're storing state information in multiple keys in the globalChannelMap. Where do you clear them out?

    It would be helpful if you could post your entire channel, as well as samples of what the entire conversation is supposed to look like.

    Comment


    • #3
      Thanks for your input. I am using Mirth 3.6.1 and have my channel along with the document which contains all messages.

      I only need to forward the OBS messages to end destination so really don't care about the Hello, EOT and END message but they are required from the Careapp I am connecting as its POCT1 communication.
      Attached Files
      Last edited by Mits87; 01-14-2019, 09:48 AM.

      Comment

      Working...
      X