Hi There is DSL for try ... catch .. kind of style.
But it is a very interesting use-case that I think should be easy to do in Camel. James any thoughts? Med venlig hilsen Claus Ibsen ...................................... Silverbullet Skovsgårdsvænget 21 8362 Hørning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: Markus Wolf [mailto:[EMAIL PROTECTED] Sent: 2. oktober 2008 11:57 To: camel-user@activemq.apache.org Subject: Re: ErrorHandler + DeadLetter -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Claus, thanks for you help. But no it does not work. The source endpoint is a jms queue and if I put it back to that queue, then the processing starts again and result in an endless loop. What we require is an error handling where configured exceptions should be set as fault or exception onto the out message and returned to the sender (the process that initiated the jms message and which is waiting for a response). Any other idea? Thanks Markus > Hi > > Yes I think you can using the ExceptionPolicyStrategy (se overriding default > behaviour) > http://activemq.apache.org/camel/error-handler.html > > You can either implement the logic in your own class (for really advanced > stuff, or you need to be 100% in control what to do), or use the default > behavior, that will look for the best matching exception route or fallback to > the default error endpoint configured on the DeadLetterChannel. > > The matching will look for: exception(TheExceptionClass.class) where you can > customize the behaviour, e.g. setting a different retry and where to route it > in case of redelivery failures. > > exception(MyPolicyException.class) > .maximumRedeliveries(1) > .setHeader(MESSAGE_INFO, constant("Damm my policy exception")) > .to(ERROR_QUEUE); > > > Notice that we will change exception to onException in Camel 1.5 as this is a > better name for the DSL. It is in fact named onException in the Spring DSL. > > So in your case you can do like this: > > exception(MySpecialException.class) > .maximumRedeliveries(0) > .to("the endpoint URL that started it"); > > So when a MySpecialException is thrown its caught by the above configuration > and routed to the ""the endpoint URL that started it". All other exceptions > is handled by the default DeadLetterChannel. > > > > We might need to clean up the wiki and add some better samples for this. > > Could you try it and report back if it worked. Then we could use your > use-case as a sample to add to the wiki > > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsgårdsvænget 21 > 8362 Hørning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > > -----Original Message----- > From: Markus Wolf [mailto:[EMAIL PROTECTED] > Sent: 2. oktober 2008 11:23 > To: camel-user@activemq.apache.org > Subject: ErrorHandler + DeadLetter > > Hi, > > is it possible to create a route where some exceptions are handled by > the deadletter queue and some other just returned to the starting endpoint? > I've only found examples where all errors are handed over to the > deadletter endpoint. > > Thanks for any help > Markus Wolf - -- NMMN - New Media Markets & Networks GmbH Geschäftsführung: Kfm. Michael Schütt Finanzamt HH-Altona UStID DE 812 699 852 HRB 71102 Hamburg HypoVereinsbank - BLZ 200 300 00 - Konto-Nr. 156 29 82 http://www.nmmn.com Tel.: +49 40 284 118 -0 Langbehnstrasse 6 Entwicklung: -720 22761 Hamburg Fax: -999 Rufen Sie uns kostenlos an: http://www.nmmn.com/call/software +++ Hausmesse am 14.11.2008 von 10:00 bis 16:00 Uhr +++ Überzeugen Sie sich auf unserer Hausmesse von unseren Produkten und Dienstleistungen! Weitere Informationen und Anmeldung unter: http://www.nmmn.com/hausmesse/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFI5Jr4DBHISU1oEKERAsp2AJ0cd1HFVf6JY2o2QP77QChDbOVwHwCgmZeC +LuL4JpRQMDzTCqK3LWc8Yc= =a48+ -----END PGP SIGNATURE-----