web stats
routeMessage and recursion - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2012, 12:37 AM
ncpunt ncpunt is offline
Mirth Newb
 
Join Date: Nov 2006
Posts: 6
ncpunt
Question routeMessage and recursion

I have a channel that uses a file reader as source and web service sender as destination. The destination uses persistent queues. In order to have more control over handling specific errors with the web service, I switched off the persistent queue (required for getting status info). After all, the files on disk already act as a queue.

In the postprocessor script I check the web service response. With specific errors I want to resend the message by rerouting it to the current channel:

java.lang.Thread.sleep(1000);
logger.error('Enter...');
router.routeMessageByChannelId(channelId, messageObject, false);
logger.error('Exit...');

But from the Enter/Exit log pattern, I can tell that this results in a recursive call. That is no problem for an error for which let says 3 retries are allowed. But what if the web service is off-line for a longer period of time? Than this solution obviously fails.

In this forum I have seen a solution in which the channel is split in a queued front-end channel and a non-queued backend channel. I guess that calling routeMessage() to route to a different channel does not result in a recursive condition. However, this solution is to complex for maintainability reasons.

As a temporary solution I have created an error channel (javascript reader/writer) that triggers every 60 seconds looking for specific errored messages in the Mirth database. However, this approach may result in an out of order message confition.

Is there really no way to get the actual web service response in a queued channel? Could this be a new feature for a future release?
Reply With Quote
  #2  
Old 04-15-2012, 05:49 PM
glenn71 glenn71 is offline
OBX.2 Kenobi
 
Join Date: Nov 2010
Location: Sydney Australia
Posts: 94
glenn71 is on a distinguished road
Default

There is probably a way to do this now if you are prepared to do some tinkering in jscript. Have a read of this thread for a similar solution using a ftp writer (some code has been posted here today).
http://www.mirthcorp.com/community/f...ead.php?t=6562

I have a few of these http senders in prod myself so if I get some time I will be writing one as well.. if you get there before me please post the code :-).
Reply With Quote
  #3  
Old 04-15-2012, 11:47 PM
ncpunt ncpunt is offline
Mirth Newb
 
Join Date: Nov 2006
Posts: 6
ncpunt
Smile Thank you!

Yes, I saw this thread too. But because it was about FTP writers it never occured to me that I could use the same principle for a web service sender. So the Answer is: Handle the web service call in javascript using a javascript writer and the appache axis libs and you are in full control.

Here I found something about this subject: http://stackoverflow.com/questions/2...l-a-webservice

There are some things to take care of. E.g. I have to add some header lines for authentication. But I am sure the appache axis library will allow me to do this.

Many thanks .
Reply With Quote
Reply

Tags
message, queue, recursion, resend, routing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:20 AM.


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