web stats
Requeueing an HTTPSender on router. - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2017, 06:22 AM
arronramsey arronramsey is offline
Mirth Newb
 
Join Date: Sep 2007
Posts: 13
arronramsey
Default Requeueing an HTTPSender on router.

Question - it is possible to re-queue an HTTPSender if a router.routeMessage funciton in the response transformer fails.

Version 3.4.1.8057

Our workflow: We have a WebAPI web site that we have all of our message mapping code in. Our workflow is to receive inbound messages with our integration engine, pass the message off to our API server for mapping / transformation, receive the transformed message back from our WebAPI server, then send the message on to the destination via the integration engine.

I am trying to re-create this in Mirth as a proof of concept (we are unhappy with our current integration vendor and are looking to change).

My channel is attached. I am able to pass the message off to our API, receive the message back, get the message from the response in the response transformer, and route the message to a channel reader / tcp sender combination. When everything is functioning, it works awesome.

In trying to introduce errors, i disabled the channel that the router.routeMessage method is trying to send the message from the API to. When the channel is turned off, i receive the error message below. I did a bunch of searching in the forums but couldn't find anything that was related to my particular issue. I did try to wrap the method in a try/catch, but the code never hits the catch. I'm assuming the error handling in router.routeMessage handles the error gracefully, and wont allow the catch to be hit.

let me know what you think.

Thanks!

Arron

Error recieved:
[2017-03-21 15:25:55,154] ERROR (com.mirth.connect.server.userutil.VMRouter:114): Error routing message to channel id: 4739ca21-7401-4130-8929-14798c01f73f
com.mirth.connect.donkey.server.channel.ChannelExc eption
at com.mirth.connect.donkey.server.channel.SourceConn ector.dispatchRawMessage(SourceConnector.java:187)
at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.dispatchRawMessage(DonkeyEngineControlle r.java:1053)
at com.mirth.connect.server.userutil.VMRouter.routeMe ssageByChannelId(VMRouter.java:104)
at com.mirth.connect.server.userutil.VMRouter.routeMe ssage(VMRouter.java:71)
at com.mirth.connect.server.userutil.VMRouter.routeMe ssage(VMRouter.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:126)
at org.mozilla.javascript.NativeJavaMethod.call(Nativ eJavaMethod.java:225)
at org.mozilla.javascript.Interpreter.interpretLoop(I nterpreter.java:1479)
at org.mozilla.javascript.Interpreter.interpret(Inter preter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(In terpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:3280)
at org.mozilla.javascript.InterpretedFunction.exec(In terpretedFunction.java:120)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.executeScript(JavaScriptTask.java:142)
at com.mirth.connect.server.transformers.JavaScriptRe sponseTransformer$ResponseTransformerTask.doCall(J avaScriptResponseTransformer.java:147)
at com.mirth.connect.server.transformers.JavaScriptRe sponseTransformer$ResponseTransformerTask.doCall(J avaScriptResponseTransformer.java:118)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Attached Files
File Type: xml Vendor ADT In Port 6661.xml (23.8 KB, 1 views)

Last edited by arronramsey; 03-22-2017 at 06:26 AM.
Reply With Quote
  #2  
Old 03-22-2017, 07:34 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Yep, that's easy to do. Try this:

Code:
var routerResponse = router.routeMessage(interfaceRoutingName, returnedMessage);
if (routerResponse.getStatus() == ERROR) {
	responseStatus = QUEUED;
}
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 03-22-2017, 10:36 AM
arronramsey arronramsey is offline
Mirth Newb
 
Join Date: Sep 2007
Posts: 13
arronramsey
Default

Thanks. I will give that a try this afternoon. Also - it seems like when i search a post, you are everywhere! lol. Thank you for being so involved with the forums.
Reply With Quote
  #4  
Old 03-23-2017, 06:46 AM
arronramsey arronramsey is offline
Mirth Newb
 
Join Date: Sep 2007
Posts: 13
arronramsey
Default

following up. worked great. Also as an FYI routerResponse is null when there is no error so on successful routes, routerResponse.getStatus() was throwing an error in the log. Below did the trick. Thanks again

var routerResponse = router.routeMessage(interfaceRoutingName, returnedMessage);
if(routerResponse != null)
{
var routerResponseMessage = routerResponse.getStatus();
if(routerResponseMessage == ERROR)
{
responseStatus = QUEUED;
}

}
Reply With Quote
Reply

Tags
httpsender, queue, re-queue, router.routemessage, webapi

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 -8. The time now is 11:24 AM.


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