Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Auto Generated responses - what do they respond? (http://www.mirthcorp.com/community/forums/showthread.php?t=12164)

gkittlaus 11-10-2014 02:00 AM

Auto Generated responses - what do they respond?
 
Hello everyone,

I'm trying to solve a (for me) tricky one challenge.

I have a webservice listener which is listening for SOAP envelopes.
These SOAPs can trigger 3 different types of messages.

Right now I do the following:
my source is configured to respond after processing
I created a variable "response" like
Code:

responseMap.put('response', ...);
This variable contains, depending on the trigger, a response for the webservice sender. It works so far.

My problem is, that one of the triggers is doing a SMB/FTP upload. This upload can fail if the server is not available. So I am running in a timeout. This is usually 20 seconds.
Now my channel waits for additional 20 seconds to send the response if I have smb/ftp problems.

Is there a way to solve this? I want an immediate response but still dynamically on the SOAP Trigger.

Thank you in advance

EDIT: Well my title doesn't fit the question anymore, sorry for the confusion. Maybe the autogenerated responses can help me? But I cannot tell what they do at all and what they contain.

narupley 11-10-2014 06:26 AM

The two things you're asking don't make sense together at all. If you need to wait until all your destinations have finished before sending a response, then you can't respond immediately. And if you want to respond immediately, then you can't be waiting on your destinations to finish.

If you want to respond immediately and don't care about using a dynamic response based on the completion status of the destinations, then that's where you would want to turn on the source queue, and use one of the auto-generate response options. Currently auto-generation is only implemented for HL7 v2.x, so if that's what your inbound data type is, then it should work.

gkittlaus 11-10-2014 07:34 AM

Quote:

Originally Posted by narupley (Post 43583)
The two things you're asking don't make sense together at all. If you need to wait until all your destinations have finished before sending a response, then you can't respond immediately. And if you want to respond immediately, then you can't be waiting on your destinations to finish.

If you want to respond immediately and don't care about using a dynamic response based on the completion status of the destinations, then that's where you would want to turn on the source queue, and use one of the auto-generate response options. Currently auto-generation is only implemented for HL7 v2.x, so if that's what your inbound data type is, then it should work.

yeah I know that sounds confusing, but is exactly what I need.

to explain it a little bit more:
we have three inbound trigger: send document, send document2 and query for data

when receiving the inbound trigger for sending a document, it can imediatly reponse back with success.
when receiving the query trigger, we want to build a response containing the data for that query. I know this is not possible, this is just logical.

Anyhow, I wannt to try something different. I don't care about the query resquest so I simply want to send a response back imediatly, regarding the trigger, meaning:
receive query > respond with "var queryResponse"
receive doc1> respond with "var doc1Response"
receive doc2> respond with "var doc2Response"

The logic works: I build something in my preprocessor like:
Code:

var tempo = new XML(SerializerFactory.getSerializer('XML').toXML(message))
var SOAPACTION = tempo['Header']['SOAPAction'].toString()

if ( SOAPACTION == 'QueryRequest' ) {
        ResponseFactory.getSentResponse('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">...query...</s:Envelope>')
} else if ( SOAPACTION == 'Document1' ) {
        ResponseFactory.getSentResponse('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">...doc1...</s:Envelope>')
} else if ( SOAPACTION == 'Document2' ) {
        ResponseFactory.getSentResponse('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">...doc2...</s:Envelope>')
}        else {
        ResponseFactory.getSentResponse('')
}

anyway, what do I have to setup that mirth will respond with what I setup in my preprocessor?
is this possible?

narupley 11-10-2014 08:00 AM

Right now, you can only respond using a custom response if the source queue is off, which in turn means that it will not respond immediately, but rather after the entire message finishes.

If you're okay with not waiting on certain destinations, you can turn on queuing for them. Then the main message processing thread will not be waiting on those destinations to finish. Then you can use the postprocessor (not the preprocessor) to return a dynamic response.


All times are GMT -8. The time now is 04:38 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation