You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2011/07/25 16:05:30 UTC

Camel Pojos + Error Handlers

Hi there! I'm producing and consuming messages using camel pojo.

So far so good but I need to configure the TransactionErrorHandler (
http://camel.apache.org/transactionerrorhandler.html) for my MDBs for
instance:

@Consume(uri="jms:queue:testQueue?transacted=true")


How do I change the behavior of the redelivery policy for it? I'd like to
use a DLQ with 3 attempts for instance.

Regards

Re: Camel Pojos + Error Handlers

Posted by Christian Müller <ch...@gmail.com>.
Hello Vinicius!

May be this discussion is also useful for you [1]. I trying to improve the
redelivery functionality when the message is read from ActiveMQ with the
"delay and schedule message delivery" functionality which was introduced in
ActiveMQ 5.4 [2].

[1]
http://camel.465427.n5.nabble.com/Missing-feature-to-handle-errors-in-a-route-which-reads-from-an-activemq-destination-td4416986.html
[2] http://activemq.apache.org/delay-and-schedule-message-delivery.html

Best,
Christian

Re: Camel Pojos + Error Handlers

Posted by Vinicius Carvalho <ja...@gmail.com>.
Hi Claus, would be a pleasure.

Any points where I could start? I looked at the job done at camel-pe (
https://github.com/obergner/camelpe/wiki) but I took a different approach,
more simpler, I don't know if I'm going to miss anything from it, but so far
it's working ok for us.

The one thing I have that camel-pe do not support (have not found on the
source code) is @Consume pojos. I detect them and register on the
camelcontext using CamelPostProcessorHelper.

We are still missing routes discovery and converters, which camel-pe has.
I'll try to get in touch with camel-pe author and maybe contribute in some
areas of his code and use it as the camel-cdi component.

I'll be glad to help

On Tue, Jul 26, 2011 at 11:17 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Jul 26, 2011 at 12:05 PM, Vinicius Carvalho
> <ja...@gmail.com> wrote:
> > Thanks once again :)
> >
> > Big fan of you guys, camel really is an amazing framework, I'm happy I'm
> > being able to integrate it with CDI in our company (Ericsson Ireland)
> >
>
> Ah that is lovely. Do you mind sharing some thoughts of integrating
> Camel with CDI?
> We do have a JIRA ticket to improve on this?
>
> I wonder what bits and pieces we may miss in a camel-cdi component to
> make this easier/easy for end users to use.
> As we we have some documentation on using this. To make it more clear
> to end users how to use CDI with Camel.
>
>
>
> > Best regards
> >
> > On Tue, Jul 26, 2011 at 9:52 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> On Tue, Jul 26, 2011 at 10:19 AM, Vinicius Carvalho
> >> <ja...@gmail.com> wrote:
> >> > Thanks Claus, will do it.
> >> >
> >> > I was wondering if the redelivery was a camel feature (independent of
> >> > endpoint) for instance, if I configure it to 5 redeliveries on a file
> >> > endpoint, it would try 5 times before failing, did I get this wrong?
> >> >
> >>
> >> Yes that is correct. Camel has its built-in redelivery error handler.
> >> So you can configure Camel to perform redeliveries.
> >> In those situations Camel will attempt to redeliver, and only if Camel
> >> fails all attempt, the message will be regarded as failed and can be
> >> rolled back.
> >>
> >> However when you use transactions (XA, JMS, JDBC etc.) then you often
> >> want those systems to perform redelivery. And therefore you disable/do
> >> not use Camel redelivery.
> >>
> >> > Also, using the Pojo annotations is it possible to use more advanced
> >> > features such the ones that we have on routes? Like filters for
> instance.
> >> >
> >>
> >> The pojo annotations can use any of the URI options for a given
> endpoint.
> >>
> >>
> >> > Regards
> >> >
> >> > On Mon, Jul 25, 2011 at 4:36 PM, Claus Ibsen <cl...@gmail.com>
> >> wrote:
> >> >
> >> >> On Mon, Jul 25, 2011 at 4:05 PM, Vinicius Carvalho
> >> >> <ja...@gmail.com> wrote:
> >> >> > Hi there! I'm producing and consuming messages using camel pojo.
> >> >> >
> >> >> > So far so good but I need to configure the TransactionErrorHandler
> (
> >> >> > http://camel.apache.org/transactionerrorhandler.html) for my MDBs
> for
> >> >> > instance:
> >> >> >
> >> >> > @Consume(uri="jms:queue:testQueue?transacted=true")
> >> >> >
> >> >> >
> >> >> > How do I change the behavior of the redelivery policy for it? I'd
> like
> >> to
> >> >> > use a DLQ with 3 attempts for instance.
> >> >> >
> >> >>
> >> >> If you use transacted acknowledge mode, then its the JMS broker that
> >> >> handles redelivery and dead letter queues.
> >> >> So check your message broker how to configure and use that.
> >> >>
> >> >> For ActiveMQ there is some details here
> >> >> http://activemq.apache.org/redelivery-policy.html
> >> >> http://activemq.apache.org/message-redelivery-and-dlq-handling.html
> >> >>
> >> >> > Regards
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Claus Ibsen
> >> >> -----------------
> >> >> FuseSource
> >> >> Email: cibsen@fusesource.com
> >> >> Web: http://fusesource.com
> >> >> Twitter: davsclaus, fusenews
> >> >> Blog: http://davsclaus.blogspot.com/
> >> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Camel Pojos + Error Handlers

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 26, 2011 at 12:05 PM, Vinicius Carvalho
<ja...@gmail.com> wrote:
> Thanks once again :)
>
> Big fan of you guys, camel really is an amazing framework, I'm happy I'm
> being able to integrate it with CDI in our company (Ericsson Ireland)
>

Ah that is lovely. Do you mind sharing some thoughts of integrating
Camel with CDI?
We do have a JIRA ticket to improve on this?

I wonder what bits and pieces we may miss in a camel-cdi component to
make this easier/easy for end users to use.
As we we have some documentation on using this. To make it more clear
to end users how to use CDI with Camel.



> Best regards
>
> On Tue, Jul 26, 2011 at 9:52 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Tue, Jul 26, 2011 at 10:19 AM, Vinicius Carvalho
>> <ja...@gmail.com> wrote:
>> > Thanks Claus, will do it.
>> >
>> > I was wondering if the redelivery was a camel feature (independent of
>> > endpoint) for instance, if I configure it to 5 redeliveries on a file
>> > endpoint, it would try 5 times before failing, did I get this wrong?
>> >
>>
>> Yes that is correct. Camel has its built-in redelivery error handler.
>> So you can configure Camel to perform redeliveries.
>> In those situations Camel will attempt to redeliver, and only if Camel
>> fails all attempt, the message will be regarded as failed and can be
>> rolled back.
>>
>> However when you use transactions (XA, JMS, JDBC etc.) then you often
>> want those systems to perform redelivery. And therefore you disable/do
>> not use Camel redelivery.
>>
>> > Also, using the Pojo annotations is it possible to use more advanced
>> > features such the ones that we have on routes? Like filters for instance.
>> >
>>
>> The pojo annotations can use any of the URI options for a given endpoint.
>>
>>
>> > Regards
>> >
>> > On Mon, Jul 25, 2011 at 4:36 PM, Claus Ibsen <cl...@gmail.com>
>> wrote:
>> >
>> >> On Mon, Jul 25, 2011 at 4:05 PM, Vinicius Carvalho
>> >> <ja...@gmail.com> wrote:
>> >> > Hi there! I'm producing and consuming messages using camel pojo.
>> >> >
>> >> > So far so good but I need to configure the TransactionErrorHandler (
>> >> > http://camel.apache.org/transactionerrorhandler.html) for my MDBs for
>> >> > instance:
>> >> >
>> >> > @Consume(uri="jms:queue:testQueue?transacted=true")
>> >> >
>> >> >
>> >> > How do I change the behavior of the redelivery policy for it? I'd like
>> to
>> >> > use a DLQ with 3 attempts for instance.
>> >> >
>> >>
>> >> If you use transacted acknowledge mode, then its the JMS broker that
>> >> handles redelivery and dead letter queues.
>> >> So check your message broker how to configure and use that.
>> >>
>> >> For ActiveMQ there is some details here
>> >> http://activemq.apache.org/redelivery-policy.html
>> >> http://activemq.apache.org/message-redelivery-and-dlq-handling.html
>> >>
>> >> > Regards
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> FuseSource
>> >> Email: cibsen@fusesource.com
>> >> Web: http://fusesource.com
>> >> Twitter: davsclaus, fusenews
>> >> Blog: http://davsclaus.blogspot.com/
>> >> Author of Camel in Action: http://www.manning.com/ibsen/
>> >>
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Camel Pojos + Error Handlers

Posted by Vinicius Carvalho <ja...@gmail.com>.
Thanks once again :)

Big fan of you guys, camel really is an amazing framework, I'm happy I'm
being able to integrate it with CDI in our company (Ericsson Ireland)

Best regards

On Tue, Jul 26, 2011 at 9:52 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Jul 26, 2011 at 10:19 AM, Vinicius Carvalho
> <ja...@gmail.com> wrote:
> > Thanks Claus, will do it.
> >
> > I was wondering if the redelivery was a camel feature (independent of
> > endpoint) for instance, if I configure it to 5 redeliveries on a file
> > endpoint, it would try 5 times before failing, did I get this wrong?
> >
>
> Yes that is correct. Camel has its built-in redelivery error handler.
> So you can configure Camel to perform redeliveries.
> In those situations Camel will attempt to redeliver, and only if Camel
> fails all attempt, the message will be regarded as failed and can be
> rolled back.
>
> However when you use transactions (XA, JMS, JDBC etc.) then you often
> want those systems to perform redelivery. And therefore you disable/do
> not use Camel redelivery.
>
> > Also, using the Pojo annotations is it possible to use more advanced
> > features such the ones that we have on routes? Like filters for instance.
> >
>
> The pojo annotations can use any of the URI options for a given endpoint.
>
>
> > Regards
> >
> > On Mon, Jul 25, 2011 at 4:36 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> On Mon, Jul 25, 2011 at 4:05 PM, Vinicius Carvalho
> >> <ja...@gmail.com> wrote:
> >> > Hi there! I'm producing and consuming messages using camel pojo.
> >> >
> >> > So far so good but I need to configure the TransactionErrorHandler (
> >> > http://camel.apache.org/transactionerrorhandler.html) for my MDBs for
> >> > instance:
> >> >
> >> > @Consume(uri="jms:queue:testQueue?transacted=true")
> >> >
> >> >
> >> > How do I change the behavior of the redelivery policy for it? I'd like
> to
> >> > use a DLQ with 3 attempts for instance.
> >> >
> >>
> >> If you use transacted acknowledge mode, then its the JMS broker that
> >> handles redelivery and dead letter queues.
> >> So check your message broker how to configure and use that.
> >>
> >> For ActiveMQ there is some details here
> >> http://activemq.apache.org/redelivery-policy.html
> >> http://activemq.apache.org/message-redelivery-and-dlq-handling.html
> >>
> >> > Regards
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Camel Pojos + Error Handlers

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 26, 2011 at 10:19 AM, Vinicius Carvalho
<ja...@gmail.com> wrote:
> Thanks Claus, will do it.
>
> I was wondering if the redelivery was a camel feature (independent of
> endpoint) for instance, if I configure it to 5 redeliveries on a file
> endpoint, it would try 5 times before failing, did I get this wrong?
>

Yes that is correct. Camel has its built-in redelivery error handler.
So you can configure Camel to perform redeliveries.
In those situations Camel will attempt to redeliver, and only if Camel
fails all attempt, the message will be regarded as failed and can be
rolled back.

However when you use transactions (XA, JMS, JDBC etc.) then you often
want those systems to perform redelivery. And therefore you disable/do
not use Camel redelivery.

> Also, using the Pojo annotations is it possible to use more advanced
> features such the ones that we have on routes? Like filters for instance.
>

The pojo annotations can use any of the URI options for a given endpoint.


> Regards
>
> On Mon, Jul 25, 2011 at 4:36 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Mon, Jul 25, 2011 at 4:05 PM, Vinicius Carvalho
>> <ja...@gmail.com> wrote:
>> > Hi there! I'm producing and consuming messages using camel pojo.
>> >
>> > So far so good but I need to configure the TransactionErrorHandler (
>> > http://camel.apache.org/transactionerrorhandler.html) for my MDBs for
>> > instance:
>> >
>> > @Consume(uri="jms:queue:testQueue?transacted=true")
>> >
>> >
>> > How do I change the behavior of the redelivery policy for it? I'd like to
>> > use a DLQ with 3 attempts for instance.
>> >
>>
>> If you use transacted acknowledge mode, then its the JMS broker that
>> handles redelivery and dead letter queues.
>> So check your message broker how to configure and use that.
>>
>> For ActiveMQ there is some details here
>> http://activemq.apache.org/redelivery-policy.html
>> http://activemq.apache.org/message-redelivery-and-dlq-handling.html
>>
>> > Regards
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Camel Pojos + Error Handlers

Posted by Vinicius Carvalho <ja...@gmail.com>.
Thanks Claus, will do it.

I was wondering if the redelivery was a camel feature (independent of
endpoint) for instance, if I configure it to 5 redeliveries on a file
endpoint, it would try 5 times before failing, did I get this wrong?

Also, using the Pojo annotations is it possible to use more advanced
features such the ones that we have on routes? Like filters for instance.

Regards

On Mon, Jul 25, 2011 at 4:36 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Mon, Jul 25, 2011 at 4:05 PM, Vinicius Carvalho
> <ja...@gmail.com> wrote:
> > Hi there! I'm producing and consuming messages using camel pojo.
> >
> > So far so good but I need to configure the TransactionErrorHandler (
> > http://camel.apache.org/transactionerrorhandler.html) for my MDBs for
> > instance:
> >
> > @Consume(uri="jms:queue:testQueue?transacted=true")
> >
> >
> > How do I change the behavior of the redelivery policy for it? I'd like to
> > use a DLQ with 3 attempts for instance.
> >
>
> If you use transacted acknowledge mode, then its the JMS broker that
> handles redelivery and dead letter queues.
> So check your message broker how to configure and use that.
>
> For ActiveMQ there is some details here
> http://activemq.apache.org/redelivery-policy.html
> http://activemq.apache.org/message-redelivery-and-dlq-handling.html
>
> > Regards
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Camel Pojos + Error Handlers

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jul 25, 2011 at 4:05 PM, Vinicius Carvalho
<ja...@gmail.com> wrote:
> Hi there! I'm producing and consuming messages using camel pojo.
>
> So far so good but I need to configure the TransactionErrorHandler (
> http://camel.apache.org/transactionerrorhandler.html) for my MDBs for
> instance:
>
> @Consume(uri="jms:queue:testQueue?transacted=true")
>
>
> How do I change the behavior of the redelivery policy for it? I'd like to
> use a DLQ with 3 attempts for instance.
>

If you use transacted acknowledge mode, then its the JMS broker that
handles redelivery and dead letter queues.
So check your message broker how to configure and use that.

For ActiveMQ there is some details here
http://activemq.apache.org/redelivery-policy.html
http://activemq.apache.org/message-redelivery-and-dlq-handling.html

> Regards
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/