Yeah sometimes it's a bit scary so much flexibility and power you have in the camel routes.
I am currently experimenting with CAMEL-895 and I am hoping that the other riders will see the light as well. Then the URI options would be even more powerful. Well that's another story, but I am just exited about it. /Claus Ibsen Apache Camel Committer Blog: http://davsclaus.blogspot.com/ On Sat, Dec 6, 2008 at 1:09 PM, Ramon Buckland <[EMAIL PROTECTED]> wrote: > Thanks Claus, > > Sorry, I should not have been so lazy to not look at the source. > > Thank you on the comment of the route, (as you can imagine - it is not even > the half of the routes :-) > > That worked beautifully .. here is a sample of the real email fired out to > gmail :-) > > Subject: system job status : unexpected fail : job-execute-1 > > An Unexpected error occured. Please review the logs for more > details. > {{{ > internal.mycompany.megasystem.CustomException: Failed > whilst scanning [some/directory/foo/bar] > }}} > > > On Sat, Dec 6, 2008 at 22:57, Claus Ibsen <[EMAIL PROTECTED]> wrote: > >> Hi >> >> That is a beautiful route, quite clever I must say. >> >> About el. I looked into it's unittest in camel-juel >> In JuelLanguageTest it doesn't have a properties test. >> >> Instead of ${in} you should use ${exchange} as the properties is on this >> object. >> >> > ${exchange.properties['CamelCauseException']} >> >> Would be nice with this properties add to the unit test of the el language. >> >> >> >> /Claus Ibsen >> Apache Camel Committer >> Blog: http://davsclaus.blogspot.com/ >> >> >> >> On Sat, Dec 6, 2008 at 12:47 PM, Ramon Buckland <[EMAIL PROTECTED]> >> wrote: >> > Hi All, >> > >> > I have come across something unusual which I am hoping someone can shed >> some >> > light on. >> > >> > I am currently testing failure paths of some routes, and as part of the >> > "reporting" of a failure, I need to send an email. >> > >> > I have a catch all onException config in the route .. >> > >> > <onException> >> > <exception>java.lang.Exception</exception> >> > <redeliveryPolicy maximumRedeliveries="0"/> >> > <multicast> >> > <to uri="direct:exceptionEmail"/> >> > <transform><constant>FAIL</constant></transform> >> > </multicast> >> > </onException> >> > >> > Which is designed to perform two tasks, >> > (a) forward the "exception" details out to an email >> > (b) respond with FAIL back to the "caller" >> > >> > (b) is working nicely. >> > >> > For (a), the direct:exceptionEmail looks as follows >> > >> > <route> >> > <from uri="direct:exceptionEmail"/> >> > <pipeline> >> > <!-- log to help with debug --> >> > <to >> > uri="log:internal.company.ExceptionFailure?level=INFO&showAll=true"/> >> > <setHeader headerName="subject">FAIL - System Status - An >> > Exception was caught</setHeader> >> > <setBody> >> > <el> >> > An unexpected error occured. Please review the logs for more >> > details. >> > ${in.properties['CamelCauseException']} >> > </el> >> > </setBody> >> > <to uri="smtp://[EMAIL PROTECTED] >> > &[EMAIL PROTECTED]"/> >> > </pipeline> >> > </route> >> > >> > The problem I am seeing is that the <el> attempting to capture the >> exception >> > details is saying there is no "properties" >> > >> > DEBUG Pipeline - Message exchange has failed so >> > breaking out of pipeline: Exchange[Message: execute-job-1] exception: >> > javax.el.PropertyNotFoundException: The class >> > 'org.apache.camel.impl.DefaultMessage' does not have the property >> > 'properties'. fault: null >> > >> > This is well and good, (I can see via the source that, indeed, >> > org.apache.camel.impl.DefaultMessage does not have a getProperties .. >> etc) >> > however, the log which is running before, shows the message does actually >> > have Properties, and the property I am after (CamelCauseException). >> > >> > INFO ExceptionFailure - >> > Exchange[Id:ID-itasca/50862-1228562841594/0-1, >> > >> Properties:{org.apache.camel.processor.DeadLetterChannel.FAILURE_HANDLED=internal.company.MyException: >> > MyException details, org.apache.camel.bean.BeanHolder=bean: aBean, >> > CamelCauseException=internal.company.MyException: MyException details}, >> > Headers:{org.apache.camel.RedeliveryCounter=0 ... --SNIP Headers-- }, >> > BodyType:String, Body:execute-job-1, Out: null] >> > >> > Where is the disconnect occuring ? Can Juel (<el>) get to the Properties >> of >> > a message ? >> > >> > I can see that Ognl (http://activemq.apache.org/camel/ognl.html) has the >> > properties exposed (so I might just switch) but if there is a bug, or >> some >> > impl to do, let me know and I can dive in to this one. >> > >> > regards >> > Ramon >> > >> >
