web stats
Mirth Community - View Single Post - Processing Response Objects in the Response Transformer for custom Acknowledgment
View Single Post
  #4  
Old 01-28-2014, 08:25 AM
amith amith is offline
Mirth Newb
 
Join Date: Aug 2010
Location: London, UK
Posts: 7
amith is on a distinguished road
Default custom Acknowledgment with queues

I've found a hacky way around this.
My Solution with Mirth v3.01: On the Source channel transformer(TEST_ADT_HL7_To_XML):

Code:
globalMap.put("ADTRESPONSE","");
globalMap.put("ADTRESPONSEREADYFLAG","false");
On the Response End channel Response Transformer (TEST_XML_Sender) - Update the response flag.

Code:
if (response.getMessage() != '') 
{
    var ResponseMessage = response.getMessage()
    var ResponseXML = new XML(ResponseMessage.toString());
    globalMap.put("ADTRESPONSE",ResponseXML.toString());
    globalMap.put("ADTRESPONSEREADYFLAG","true");
}else{//wait if queued}
On the Response End channel Post-Processor(TEST_XML_Sender) - Set the Response setting to "Post Processor" Write a While loop. (use a timeoout if you want don't want to wait forever)

Code:
var ADTResponseReadyFlag = globalMap.get("ADTRESPONSEREADYFLAG");

if(debug)logger.info("Start Response Wait")
while(ADTResponseReadyFlag == "false")
{
  ADTResponseReadyFlag = globalMap.get("ADTRESPONSEREADYFLAG");
}
if(debug) logger.info("End Response Wait")
return globalMap.get("ADTRESPONSE");

Last edited by amith; 01-28-2014 at 08:27 AM. Reason: code blocking
Reply With Quote