-
1. Re: Exception handling in ESB
tomeicher Jul 21, 2010 7:04 AM (in response to vishnumathi)action1 can terminate the pipeline by returning null.
Cheers, Tom.
-
2. Re: Exception handling in ESB
joe_boy12 Mar 28, 2011 5:10 PM (in response to tomeicher)I want to send custom XML reply when exceptions happen so I wrote following in @onException method..
somehow its not sending custom message but sends a complete stack trace of exception that caused the execution on this method. Any idea?
@OnException
public void error( Message msg )
{
if( log.isInfoEnabled())
{
log.info("+++++++++++++++++++ In error() +++++++++++++ :: OUCH " + msg.getFault());
}String error = "<fault code=\"111\" order_id=\"O1234567\"><cause desc=\"SOMETHING BAD HAPPENED\"/></fault>";
msg.getBody().add(error);HttpResponse response = new HttpResponse(200);
//HttpResponse response = HttpResponse.getResponse(msg); // throws NPE
response.setContentType("text/xml");
response.setEncoding("UTF-8");
response.setResponse(msg);
}