Hi
As a spare time camel rider I will have time to look into this in the
weekend where it's supposed to be cold weather.
So I will look into it at that time. Now I have the laptop on my lap
and cant really do coding ;)
Ad 1)
Yes I think you can do this.
BTW you can also use seda queus instead of JMS queues. See seda on the
camel component overview.
Ad 2)
I do think it should be possible if you write your own exception
policy where you can do the enum test as well.
But what you is looking for is to attach a predicate to the
onException where you can do the extra test
Something like this,
onException(MyTechnicalException.class).when("bean:hasSpecialEnum).
So the onException is only triggered if the preidicate passes as well.
But I guess you could do this with a content based router (choice) and
using a bean to test the condition
onException(MyTechnicalException.class)
.choice()
.when("bean:hasSpecialEnumTester").
.to("bean:specialHandling")
.otherwise().to("bean:normalHandling");
I doubt we have something that can test if a class has an enum as a
DSL so use a bean.
You can get the exception using
public class MySpecialEnumTester
public boolean hasEnum(Exchange exchange) {
Exception e = exchange.getExchange();
// test for enum
return true or false
}
}
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
On Wed, Nov 19, 2008 at 4:20 PM, Fush <[EMAIL PROTECTED]> wrote:
>
>
> Claus Ibsen-2 wrote:
>>
>> Sort of. I am about to leave the office, but you have a very
>> interesting use-case that I need to dig into. If time permits I will
>> be online tonight.
>>
>> You can define your own exception policy strategy:
>> http://activemq.apache.org/camel/error-handler.html
>>
>> That is the policy to determine which onException should be triggered.
>>
>> But to get it clear.
>> If your bean myOwnErrorHandler throws an exception what do you want to
>> happen?
>> If myOwnErrorHandler throws an exception, I want the same thing to happen
>> as with any other exception than FunctionalException. For my use case,
>> that means a certain number of redeliveries and a certain delay time, and
>> is defined by the redeliveryPolicyConfig bean.
>
> But I've now chosen to solve this by using an extra queue. So in case of a
> FunctionalException, instead of routing the message to myOwnErrorHandler,
> I'll route the message to myOwnErrorQueue. And I'll set up a new route that
> listens to myOwnErrorQueue, which will route any message from that queue to
> myOwnErrorHandler. That way, any exceptions thrown by myOwnErrorHandler will
> be handled by the same policy that's set up for the
> ActiveMQConnectionFactory. How does that sound to you?
>
> Still, I have these to issues to resolve:
> 1. The onException part seems to be triggered, even if the Exception is not
> a FunctionalException. I'm curious about if that's a bug, or if there's
> something wrong with my configuration.
> 2. The onException should ideally not just check the exception type, but
> also an Enum within the exception, indicating an error code, before deciding
> if it needs "special treatment". As far as I can tell, that's not supported
> by the Camel XML.
> --
> View this message in context:
> http://www.nabble.com/1.5-error-handling-Spring-config-buggy-not-complete--tp20562554s22882p20582041.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>