|
Hi.
how to manage the TCP acknowledgment with Camel. I have a route that receives via mina:TCP for HL7 message (MllpHl7Codec) when the route ends, the contents of the body is returned Socket as ACK. the route ends in the onComplete().onCompleteOnly() if an error occurs, whithout exception treatment, camel send the exception in the socket and causes an error. the route ends in the onComplete().onFailed() if I add a onException to catch the error. I can place a NACK in the body and clear the error the NACK is then sent into the socket but the route ends in the onComplete().onCompleteOnly(). This makes sense because I have removed the error of the exchange. How to Return a NACK and finish the route in the onComplete().OnFailed()? Thank you. A+JYT |
|
Hi
As mentioned on the on completion web page http://camel.apache.org/oncompletion.html Camel spins of a new and separate thread to process the on completion. So its *extra* work that runs on the side of the original route. So you should NOT use that to send back a ACK or NACK. That should be computed and handled in your original route. The on completion, can be used to trigger async log messages to be send to a log central database, or fire out an email, or send a alert to a snmp server, or something else. We may wanna emphasize that better on the documentation page in the future. On Sun, May 6, 2012 at 2:35 PM, sekaijin <[hidden email]> wrote: > Hi. > > how to manage the TCP acknowledgment with Camel. > > I have a route that receives via mina:TCP for HL7 message (MllpHl7Codec) > when the route ends, the contents of the body is returned Socket as ACK. > the route ends in the onComplete().onCompleteOnly() > > if an error occurs, whithout exception treatment, camel send the exception > in the socket and causes an error. > the route ends in the onComplete().onFailed() > > if I add a onException to catch the error. I can place a NACK in the body > and clear the error > the NACK is then sent into the socket but the route ends in the > onComplete().onCompleteOnly(). > This makes sense because I have removed the error of the exchange. > > How to Return a NACK and finish the route in the onComplete().OnFailed()? > > Thank you. > A+JYT > > -- > View this message in context: http://camel.465427.n5.nabble.com/Mina-TCP-MllpHl7-NACK-and-onComplete-OnFailed-howto-tp5689190.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ |
|
Hi
I do not use onComplete to send ACK or NACK. I use onComplete().onCompleteOnly() to log Ok and onComplete().OnFailed() to log KO in my main route, if I do not catch the error the NACK is not sent to the socket and onComplete() log KO the If i catch the error, the NACK is sent to the socket and onComplete log OK the question is How to send the NACK in the main road and pass the onComplete().onFailed () to log KO (not Ok) onComplete().onCompleteOnly().log("OK"); onComplete().onFailed().log("KO") // 1) without catch the transform bean raise exception. // the route finsh on fail // an other exception is raised "could not write Myexception in socket // the onComplete().onFailed is activated and log KO From("mina:tcp:.....") .bean("transform") // raise an exception .inOnly("jms:out"); // 2) with catch the transform bean raise exception. // the exception is catched // the NACK is sent to socket // the route finish without error // the onComplete().ononComplete is activated ans log KO From("mina:tcp:.....") .dotray() .bean("transform") // raise an exception .inOnly("jms:out") .doCatch(...) .bean(SetBodyAsNACK) // define content of Nack .bean(RemoveErrorOnEchange) // if the error is not removed mine try to send the exception tout the socket .end() I want // 2) with catch the transform bean raise exception. // the exception is catched // the NACK is sent to socket // the route finish // the onComplete().onFailed is activated and log KO A + JYT |
|
sorry an error in my post
// 2) with catch the transform bean raise exception. // the exception is catched // the NACK is sent to socket // the route finish without error // the onComplete().ononComplete is activated ans log KO A+JYT |
| Powered by Nabble | Edit this page |
