You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ncolomer <nc...@octo.com> on 2013/01/11 19:44:13 UTC

Retrieve failed Route from deadLetterChannel ?

Hi Camel community,

I am facing a problem using the Camel's deadLetterChannel.

I have several Routes that process messages and delegate to a Route-scoped
errorHandler when something bad happen (HTTP endpoint timeout for instance).

What I try to achieve is to implement a generic Route as deadLetterChannel
to handle all kind of Route failure and act accordingly (actually, persist
object on the filesystem and send an email).

The problem is that filename and mail subject are different, depending on
the Route the failure was triggered from. I need to implement some logic to
retrieve the failure context (i.e. from which Route it was triggered) and
set some headers accordingly.

Is there a possibility to retrieve failed Route (instance / ID or URI) via
the Exchange object (Processor) ? If it's not the case, can we set headers
in the Route specific errorHandler that will be used in the generic
deadLetterChannel (worse as Route depends on caller) ? Do you see a better
way ?

My Java code currently looks like that :

MyRoute route definition :

from(MyRoute.URI).routeId(MyRoute.ID)
   
.errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage()
       
.maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay)
        .log(MyRoute.FAILURE).logHandled(true)
        .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true)
       
.retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false))
     // ... Route's stuff ...

DeadLetterRoute route definition :

from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID)
    .process(new DeadLetterProcessor()) // Retrieves failed route and set
headers accordingly
    .setHeader("from", simple("${properties:mail.from}"))
    .setHeader("to", simple("${properties:mail.to}"))
    .to("file:{{error.directory}}")
    .to("smtp:{{mail.server.url}}");


Thanks in advance for your help,
Nicolas



--
View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Retrieve failed Route from deadLetterChannel ?

Posted by Christian Müller <ch...@gmail.com>.
I went ahead and added the dates we have in mind to JIRA [1]. The dates are
not committed. It's what we plan to achieve...

[1] https://issues.apache.org/jira/browse/CAMEL

Best,
Christian

On Mon, Jan 14, 2013 at 10:32 AM, ncolomer <nc...@octo.com> wrote:

> Hi Claus,
>
> I didn't found any information about 2.10.4 release date? Is there any date
> planned?
>
> Best regards,
> Nicolas
>
>
> 2013/1/12 Nicolas Colomer <nc...@octo.com>
>
> > Hi Claus,
> >
> > Thank you for your answer and the quick fix! This is exactly what I
> needed
> > :)
> >
> > Best regards,
> > Nicolas
> >
> >
> > 2013/1/12 Claus Ibsen-2 [via Camel] <
> > ml-node+s465427n5725448h88@n5.nabble.com>
> >
> >  Hi
> >>
> >> I have logged a ticket to let the route id be accessible for end users
> >> https://issues.apache.org/jira/browse/CAMEL-5959
> >>
> >>
> >> On Fri, Jan 11, 2013 at 7:44 PM, ncolomer <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5725448&i=0>>
> >> wrote:
> >>
> >> > Hi Camel community,
> >> >
> >> > I am facing a problem using the Camel's deadLetterChannel.
> >> >
> >> > I have several Routes that process messages and delegate to a
> >> Route-scoped
> >> > errorHandler when something bad happen (HTTP endpoint timeout for
> >> instance).
> >> >
> >> > What I try to achieve is to implement a generic Route as
> >> deadLetterChannel
> >> > to handle all kind of Route failure and act accordingly (actually,
> >> persist
> >> > object on the filesystem and send an email).
> >> >
> >> > The problem is that filename and mail subject are different, depending
> >> on
> >> > the Route the failure was triggered from. I need to implement some
> >> logic to
> >> > retrieve the failure context (i.e. from which Route it was triggered)
> >> and
> >> > set some headers accordingly.
> >> >
> >> > Is there a possibility to retrieve failed Route (instance / ID or URI)
> >> via
> >> > the Exchange object (Processor) ? If it's not the case, can we set
> >> headers
> >> > in the Route specific errorHandler that will be used in the generic
> >> > deadLetterChannel (worse as Route depends on caller) ? Do you see a
> >> better
> >> > way ?
> >> >
> >> > My Java code currently looks like that :
> >> >
> >> > MyRoute route definition :
> >> >
> >> > from(MyRoute.URI).routeId(MyRoute.ID)
> >> >
> >> >
> >>
> .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage()
> >> >
> >> >
> >>
> .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay)
> >> >         .log(MyRoute.FAILURE).logHandled(true)
> >> >
> >> .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true)
> >> >
> >> > .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false))
> >> >      // ... Route's stuff ...
> >> >
> >> > DeadLetterRoute route definition :
> >> >
> >> > from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID)
> >> >     .process(new DeadLetterProcessor()) // Retrieves failed route and
> >> set
> >> > headers accordingly
> >> >     .setHeader("from", simple("${properties:mail.from}"))
> >> >     .setHeader("to", simple("${properties:mail.to}"))
> >> >     .to("file:{{error.directory}}")
> >> >     .to("smtp:{{mail.server.url}}");
> >> >
> >> >
> >> > Thanks in advance for your help,
> >> > Nicolas
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> Red Hat, Inc.
> >> FuseSource is now part of Red Hat
> >> Email: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5725448&i=1>
> >> Web: http://fusesource.com
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> >> discussion below:
> >>
> >>
> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725448.html
> >>  To unsubscribe from Retrieve failed Route from deadLetterChannel ?,
> click
> >> here<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5725420&code=bmNvbG9tZXJAb2N0by5jb218NTcyNTQyMHw5MDU2MzAzMjc=
> >
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >>
> >
> >
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725533.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Re: Retrieve failed Route from deadLetterChannel ?

Posted by ncolomer <nc...@octo.com>.
Hi Claus,

I didn't found any information about 2.10.4 release date? Is there any date
planned?

Best regards,
Nicolas


2013/1/12 Nicolas Colomer <nc...@octo.com>

> Hi Claus,
>
> Thank you for your answer and the quick fix! This is exactly what I needed
> :)
>
> Best regards,
> Nicolas
>
>
> 2013/1/12 Claus Ibsen-2 [via Camel] <
> ml-node+s465427n5725448h88@n5.nabble.com>
>
>  Hi
>>
>> I have logged a ticket to let the route id be accessible for end users
>> https://issues.apache.org/jira/browse/CAMEL-5959
>>
>>
>> On Fri, Jan 11, 2013 at 7:44 PM, ncolomer <[hidden email]<http://user/SendEmail.jtp?type=node&node=5725448&i=0>>
>> wrote:
>>
>> > Hi Camel community,
>> >
>> > I am facing a problem using the Camel's deadLetterChannel.
>> >
>> > I have several Routes that process messages and delegate to a
>> Route-scoped
>> > errorHandler when something bad happen (HTTP endpoint timeout for
>> instance).
>> >
>> > What I try to achieve is to implement a generic Route as
>> deadLetterChannel
>> > to handle all kind of Route failure and act accordingly (actually,
>> persist
>> > object on the filesystem and send an email).
>> >
>> > The problem is that filename and mail subject are different, depending
>> on
>> > the Route the failure was triggered from. I need to implement some
>> logic to
>> > retrieve the failure context (i.e. from which Route it was triggered)
>> and
>> > set some headers accordingly.
>> >
>> > Is there a possibility to retrieve failed Route (instance / ID or URI)
>> via
>> > the Exchange object (Processor) ? If it's not the case, can we set
>> headers
>> > in the Route specific errorHandler that will be used in the generic
>> > deadLetterChannel (worse as Route depends on caller) ? Do you see a
>> better
>> > way ?
>> >
>> > My Java code currently looks like that :
>> >
>> > MyRoute route definition :
>> >
>> > from(MyRoute.URI).routeId(MyRoute.ID)
>> >
>> >
>> .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage()
>> >
>> >
>> .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay)
>> >         .log(MyRoute.FAILURE).logHandled(true)
>> >
>> .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true)
>> >
>> > .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false))
>> >      // ... Route's stuff ...
>> >
>> > DeadLetterRoute route definition :
>> >
>> > from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID)
>> >     .process(new DeadLetterProcessor()) // Retrieves failed route and
>> set
>> > headers accordingly
>> >     .setHeader("from", simple("${properties:mail.from}"))
>> >     .setHeader("to", simple("${properties:mail.to}"))
>> >     .to("file:{{error.directory}}")
>> >     .to("smtp:{{mail.server.url}}");
>> >
>> >
>> > Thanks in advance for your help,
>> > Nicolas
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5725448&i=1>
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725448.html
>>  To unsubscribe from Retrieve failed Route from deadLetterChannel ?, click
>> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5725420&code=bmNvbG9tZXJAb2N0by5jb218NTcyNTQyMHw5MDU2MzAzMjc=>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725533.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Retrieve failed Route from deadLetterChannel ?

Posted by ncolomer <nc...@octo.com>.
Hi Claus,

Thank you for your answer and the quick fix! This is exactly what I needed
:)

Best regards,
Nicolas


2013/1/12 Claus Ibsen-2 [via Camel] <
ml-node+s465427n5725448h88@n5.nabble.com>

> Hi
>
> I have logged a ticket to let the route id be accessible for end users
> https://issues.apache.org/jira/browse/CAMEL-5959
>
>
> On Fri, Jan 11, 2013 at 7:44 PM, ncolomer <[hidden email]<http://user/SendEmail.jtp?type=node&node=5725448&i=0>>
> wrote:
>
> > Hi Camel community,
> >
> > I am facing a problem using the Camel's deadLetterChannel.
> >
> > I have several Routes that process messages and delegate to a
> Route-scoped
> > errorHandler when something bad happen (HTTP endpoint timeout for
> instance).
> >
> > What I try to achieve is to implement a generic Route as
> deadLetterChannel
> > to handle all kind of Route failure and act accordingly (actually,
> persist
> > object on the filesystem and send an email).
> >
> > The problem is that filename and mail subject are different, depending
> on
> > the Route the failure was triggered from. I need to implement some logic
> to
> > retrieve the failure context (i.e. from which Route it was triggered)
> and
> > set some headers accordingly.
> >
> > Is there a possibility to retrieve failed Route (instance / ID or URI)
> via
> > the Exchange object (Processor) ? If it's not the case, can we set
> headers
> > in the Route specific errorHandler that will be used in the generic
> > deadLetterChannel (worse as Route depends on caller) ? Do you see a
> better
> > way ?
> >
> > My Java code currently looks like that :
> >
> > MyRoute route definition :
> >
> > from(MyRoute.URI).routeId(MyRoute.ID)
> >
> >
> .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage()
> >
> >
> .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay)
> >         .log(MyRoute.FAILURE).logHandled(true)
> >
> .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true)
> >
> > .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false))
> >      // ... Route's stuff ...
> >
> > DeadLetterRoute route definition :
> >
> > from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID)
> >     .process(new DeadLetterProcessor()) // Retrieves failed route and
> set
> > headers accordingly
> >     .setHeader("from", simple("${properties:mail.from}"))
> >     .setHeader("to", simple("${properties:mail.to}"))
> >     .to("file:{{error.directory}}")
> >     .to("smtp:{{mail.server.url}}");
> >
> >
> > Thanks in advance for your help,
> > Nicolas
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5725448&i=1>
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725448.html
>  To unsubscribe from Retrieve failed Route from deadLetterChannel ?, click
> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5725420&code=bmNvbG9tZXJAb2N0by5jb218NTcyNTQyMHw5MDU2MzAzMjc=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725462.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Retrieve failed Route from deadLetterChannel ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have logged a ticket to let the route id be accessible for end users
https://issues.apache.org/jira/browse/CAMEL-5959


On Fri, Jan 11, 2013 at 7:44 PM, ncolomer <nc...@octo.com> wrote:
> Hi Camel community,
>
> I am facing a problem using the Camel's deadLetterChannel.
>
> I have several Routes that process messages and delegate to a Route-scoped
> errorHandler when something bad happen (HTTP endpoint timeout for instance).
>
> What I try to achieve is to implement a generic Route as deadLetterChannel
> to handle all kind of Route failure and act accordingly (actually, persist
> object on the filesystem and send an email).
>
> The problem is that filename and mail subject are different, depending on
> the Route the failure was triggered from. I need to implement some logic to
> retrieve the failure context (i.e. from which Route it was triggered) and
> set some headers accordingly.
>
> Is there a possibility to retrieve failed Route (instance / ID or URI) via
> the Exchange object (Processor) ? If it's not the case, can we set headers
> in the Route specific errorHandler that will be used in the generic
> deadLetterChannel (worse as Route depends on caller) ? Do you see a better
> way ?
>
> My Java code currently looks like that :
>
> MyRoute route definition :
>
> from(MyRoute.URI).routeId(MyRoute.ID)
>
> .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage()
>
> .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay)
>         .log(MyRoute.FAILURE).logHandled(true)
>         .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true)
>
> .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false))
>      // ... Route's stuff ...
>
> DeadLetterRoute route definition :
>
> from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID)
>     .process(new DeadLetterProcessor()) // Retrieves failed route and set
> headers accordingly
>     .setHeader("from", simple("${properties:mail.from}"))
>     .setHeader("to", simple("${properties:mail.to}"))
>     .to("file:{{error.directory}}")
>     .to("smtp:{{mail.server.url}}");
>
>
> Thanks in advance for your help,
> Nicolas
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen