Thanks,

I was able to catch the Exception by wrapping the processor as you said.
Works like a charm.

Although I still think I am doing something wrong in general, as I cannot
catch exceptions I deliberately throw from my MessageRouter class...
(starting to get that feeling that I need to use spring?)

from("ibmmq:B2B.B2B.Q.1")             
                  .recipientList().method(MessageRouter.class,
"routeTo").onException(java.lang.Exception.class).to("ibmmq:B2B.B2B.Q.3");//.inheritErrorHandler(true);

MessageRouter.class:
public String routeTo(String body) throws Exception {
      System.out.println("body is : " + body);
      int endPos = body.lastIndexOf(":");
      String endPoint = body.substring(endPos+2, body.length());
      if (endPoint.equals("0") || endPoint.equals("1")) {
         endPoint = "2";
         throw new Exception("No destination queue found for message: " +
body);
      }
      String queueName = "ibmmq:B2B.B2B.Q."+endPoint;      
      return queueName;
  }

Is there something I am doing wrong? 

Regards
Dylan.


--
View this message in context: 
http://camel.465427.n5.nabble.com/Unable-to-catch-exception-from-Camel-tp4528048p4535036.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to