camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel Exception and Velocity - Blank Values
Date Fri, 21 Nov 2014 07:46:17 GMT
Hi

A good idea is to check the unit tests of camel-velocity to see how
those templates are done there, this may help you.

On Fri, Nov 21, 2014 at 8:42 AM, contactreji <contactreji@gmail.com> wrote:
> Hi
>
> I have a route as follows which consumes from a vm: endpoint. Data comes to
> this endpoint from an exception handler in another module.
>
> I am trying to send alert mails for this exception using camel velocity.
>
> I used both {in.headers.CAMEL_EXCEPTION} was well as ${exception} in the
> camel veloctity template to populate the exception string. Both yeilds BLANK
> output.
>
> Can someone give me a clue.
>
> Also looks like *<setHeader headerName="CAMEL_EXCEPTION ">
>                                 <simple>${exception}</simple>
>                         </setHeader>* too doesnt work since I am trying to print
header but again
> no value :-(
>
>
> Below is my route file!
>
>         *       <route id="UTILITY_Multicasting">
>
>                         <from uri="vm:Q_EXCEPTIONSTRATEGY" />
>                         <setExchangePattern pattern="InOnly" />
>
>                         <log message="Message from Exception Handler Module - Details
:
> ${exception}"
>                                 loggingLevel="WARN" logName="ExceptionHandlerModule"
/>
>
>                         <setHeader headerName="CAMEL_EXCEPTION ">
>                                 <simple>${exception}</simple>
>                         </setHeader>
>
>                         <log
>                                 message="CAMEL_EXCEPTION Header populated as
> ${in.header.CAMEL_EXCEPTION}"
>                                 loggingLevel="WARN" logName="ExceptionDetails" />
>
>                         <multicast stopOnException="true">
>                                 <to uri="seda:EmailAlert" />
>                                 <to uri="seda:DBUpdate" />
>                         </multicast>
>                 </route>
>
>                 <route id="UTILITY_AlertMails">
>
>                         <from uri="seda:EmailAlert" />
>                         <setExchangePattern pattern="InOnly" />
>
>                         <log logName="ExceptionHandling" loggingLevel="INFO"
>                                 message="Exception received for TXN_NO ${in.header.TXN_ID}.
Preparing
> the Email Alert" />
>
>
>                         <setHeader headerName="to">
>                                 <simple>{{alertEmailTo}}</simple>
>                         </setHeader>
>                         <setHeader headerName="CC">
>                                 <simple>{{alertEmailCC}}</simple>
>                         </setHeader>
>                         <setHeader headerName="from">
>                                 <simple>{{alertMailFrom}}</simple>
>                         </setHeader>
>                         <setHeader headerName="subject">
>                                 <simple>{{alertMailSubject}} - ${in.header.INTERFACE_ID}
: TXN
> ${in.header.TXN_ID}</simple>
>                         </setHeader>
>                         <setHeader headerName="contentType">
>                                 <constant>text/plain</constant>
>                         </setHeader>
>                         <to
>
> uri="velocity:file://D:/velocitytemplates/AlertMailFormat.vm?contentCache=true"
> />
>                         <setHeader headerName="archivePath">
>                                 <simple>{{fuseArchivePath}}/${in.header.INTERFACE_NAME}</simple>
>                         </setHeader>
>                         <to uri="bean:AddAttachmentProcessor" />
>                         <to uri="smtp://{{smtpServerUrl}}?mapMailMessage=true" />
>                 </route>
> *
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Exception-and-Velocity-Blank-Values-tp5759407.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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/

Mime
View raw message