Coudln't you just add a 2nd or 3rd exception(T.class) for the different type?
// 1) how exceptions should be handled
exception(MyBusinessException.class)
.maximumRedeliveries(1)
.to(xxx);
exception(CamelException.class)
.maximumRedeliveries(2)
.to(yyy);
exception(ConnectionException.class)
.maximumRedeliveries(4)
.to(zzz);
In Camel 1.4 the logic to determine which exception is best suited for the
above configured types is improved.
See ExceptionPolicyStrategy.
http://activemq.apache.org/camel/dead-letter-channel.html
// 2) then my routes should be configured after (1) as they will inherit the
exception strategies from (1).
from("xxx").to("yyy");
from("zzz").to("foo");
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: pratibhaG [mailto:[EMAIL PROTECTED]
Sent: 23. maj 2008 12:43
To: [email protected]
Subject: RE: How to handle different types of errors?
I want to tap message from these two routes for different Exception types:
1) jbi:endpoint:http://test/MyService/endpoint -->
jbi:endpoint:http://test/MyProviderServicePortal/providerEndpointPortal
2) jbi:endpoint:http://test/MyService/endpoint
-->jbi:endpoint:http://test/MyProviderService/providerEndpoint
there can be many types of exceptions like NullPointerException,
ConnectionException or my custom exceptions on both the routes how can I
handle the situation?
I tried this
exception(java.net.ConnectionException.class).maximumRedeliveries(4).to("jbi:endpoint:http://test/errorStorageService/errorStorageEndpoint");
from("jbi:endpoint:http://test/MyService/endpoint").to("jbi:endpoint:http://test/MyProviderService/providerEndpoint");
It works fine. that is when a message flows from
jbi:endpoint:http://test/MyService/endpoint to
jbi:endpoint:http://test/MyProviderService/providerEndpoint if
ConnectionException arises then it is sent to
jbi:endpoint:http://test/errorStorageService/errorStorageEndpoint after 4
times retrial.
But on this path there can be other exceptions and I want to take different
action based on the exception type.
please help
-Pratibha
--
View this message in context:
http://www.nabble.com/RE%3A-How-to-handle-different-types-of-errors--tp17420074s22882p17423142.html
Sent from the Camel - Users mailing list archive at Nabble.com.