You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jeremy Gooch <je...@huwun.com> on 2014/12/15 12:29:49 UTC

Programmatically referring to route/context names within routes,

Hi,

I have a generic dead letter queue handler.  Before messages are put onto
the dead letter queue, my routes log details of the exceptions (via an
interceptor within the same context).  I'd like to also stamp the messages
with the route and context from which the exception was thrown.

I could just type the correct names into every interceptor, but it would be
nicer if I could do something like this:

        <!-- Make the route log the exception before sending to the dead
letter queue -->
        <interceptSendToEndpoint uri="{{dead.letter.uri}}"
id="deadletter-logger">
            <log logName="jellyfish-messaging" loggingLevel="ERROR"
message="Dead letter interceptor invoked" />
            <to
uri="log:org.jellyfish.notifications?level=ERROR&amp;showCaughtException=true&amp;showStackTrace=true&amp;showException=true"
/>








*            <setOutHeader headerName="DLQ-context">
 <constant>{{camel-current-context-id}}</constant>
 </setOutHeader>            <setOutHeader headerName="DLQ-route">
     <constant>{{camel-intercepted-route-id}}</constant>
 </setOutHeader>*        </interceptSendToEndpoint>

You'll note that I'm already pulling in the dead letter queue name from
config - i.e. {{dead.letter.uri}}. The magic sauce would be having
environment variables like:-

   - {{camel-current-context-id}}
   - {{camel-intercepted-route-id}}

Is this sort of thing available?
I'm running Camel 2.12.3 and ActiveMQ on 5.7.0.

Thanks,

J.

Re: Programmatically referring to route/context names within routes,

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

See the simple language which has many details.
And the message history eip
http://camel.apache.org/message-history

On Mon, Dec 15, 2014 at 12:29 PM, Jeremy Gooch <je...@huwun.com> wrote:
> Hi,
>
> I have a generic dead letter queue handler.  Before messages are put onto
> the dead letter queue, my routes log details of the exceptions (via an
> interceptor within the same context).  I'd like to also stamp the messages
> with the route and context from which the exception was thrown.
>
> I could just type the correct names into every interceptor, but it would be
> nicer if I could do something like this:
>
>         <!-- Make the route log the exception before sending to the dead
> letter queue -->
>         <interceptSendToEndpoint uri="{{dead.letter.uri}}"
> id="deadletter-logger">
>             <log logName="jellyfish-messaging" loggingLevel="ERROR"
> message="Dead letter interceptor invoked" />
>             <to
> uri="log:org.jellyfish.notifications?level=ERROR&amp;showCaughtException=true&amp;showStackTrace=true&amp;showException=true"
> />
>
>
>
>
>
>
>
>
> *            <setOutHeader headerName="DLQ-context">
>  <constant>{{camel-current-context-id}}</constant>
>  </setOutHeader>            <setOutHeader headerName="DLQ-route">
>      <constant>{{camel-intercepted-route-id}}</constant>
>  </setOutHeader>*        </interceptSendToEndpoint>
>
> You'll note that I'm already pulling in the dead letter queue name from
> config - i.e. {{dead.letter.uri}}. The magic sauce would be having
> environment variables like:-
>
>    - {{camel-current-context-id}}
>    - {{camel-intercepted-route-id}}
>
> Is this sort of thing available?
> I'm running Camel 2.12.3 and ActiveMQ on 5.7.0.
>
> Thanks,
>
> J.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/