Wow! Thanks Claus. It worked like a charm One more challenge I am facing now is to pick up the exchange values using simple expressions in a log statement. I am trying to do something like below
from("file:C:\\Users\\Z001NLH\\Desktop\\in3").setProperty("exchangeTXNNumber",simple("exchangeId")) .setProperty("newExchangeTXNNumber",simple("property.exchangeTXNNumber")) .log("Properties are "+ simple("property.exchangeTXNNumber") +" and "+simple("property.exchangeTXNNumber")).to("log:MyLOG?showAll=true").end() In short, I am trying to embed cappabilities of Simple Expressions along with hardcoded custom messages. Logs --------------- [main] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.1 (CamelContext: camel-1) started in 4.880 seconds [Camel (camel-1) thread #12 - file://C:%5CUsers%5CZ001NLH%5CDesktop%5Cin3] INFO route3 - Properties are Simple: property.exchangeTXNNumber and Simple: property.exchangeTXNNumber [Camel (camel-1) thread #12 - file://C:%5CUsers%5CZ001NLH%5CDesktop%5Cin3] INFO MyLOG - Exchange[Id: ID-FWLYGZ1-59642-1446355498209-0-2, ExchangePattern: InOnly, Properties: {CamelBatchComplete=true, CamelBatchIndex=0, CamelBatchSize=1, CamelCreatedTimestamp=Sun Nov 01 10:55:29 IST 2015, CamelFileExchangeFile=GenericFile[C:\Users\Z001NLH\Desktop\in3\MEETING NOTES.txt], CamelFileLockFileAcquired=true, CamelFileLockFileName=C:\Users\Z001NLH\Desktop\in3\MEETING NOTES.txt.camelLock, CamelMessageHistory=[DefaultMessageHistory[routeId=route3, node=setProperty1], DefaultMessageHistory[routeId=route3, node=setProperty2], DefaultMessageHistory[routeId=route3, node=log3], DefaultMessageHistory[routeId=route3, node=to3]], CamelToEndpoint=log://MyLOG?showAll=true, exchangeTXNNumber=ID-FWLYGZ1-59642-1446355498209-0-2, newExchangeTXNNumber=ID-FWLYGZ1-59642-1446355498209-0-2}, Headers: {breadcrumbId=ID-FWLYGZ1-59642-1446355498209-0-1, CamelFileAbsolute=true, CamelFileAbsolutePath=C:\Users\Z001NLH\Desktop\in3\MEETING NOTES.txt, CamelFileContentType=text/plain, CamelFileLastModified=1445867243036, CamelFileLength=695, CamelFileName=MEETING NOTES.txt, CamelFileNameConsumed=MEETING NOTES.txt, CamelFileNameOnly=MEETING NOTES.txt, CamelFileParent=C:\Users\Z001NLH\Desktop\in3, CamelFilePath=C:\Users\Z001NLH\Desktop\in3\MEETING NOTES.txt, CamelFileRelativePath=MEETING NOTES.txt}, BodyType: org.apache.camel.component.file.GenericFile, Body: [Body is file based: GenericFile[C:\Users\Z001NLH\Desktop\in3\MEETING NOTES.txt]], Out: null: ] On Sat, Oct 31, 2015 at 10:53 PM, Claus Ibsen-2 [via Camel] < ml-node+s465427n5773296...@n5.nabble.com> wrote: > Try with > > .setProperty("bodyBackup", simple("body")) > > On Sat, Oct 31, 2015 at 4:40 PM, contactreji <[hidden email] > <http:///user/SendEmail.jtp?type=node&node=5773296&i=0>> wrote: > > > Hey > > > > Any Groovy experts out there who has tried writing Camel Simple > expression > > in groovy camel routes? Can someone post an example. > > > > I tried > > > *rom("file:C:\\Users\\Mathews\\Desktop\\in").log(LoggingLevel.INFO,"BasicRouteLogger","Received > > > File").setProperty("bodyBackup",$simple{body}).log("Done ").end()* > > > > but its throwing exceptions > > > > Cheers > > Reji > > > > > > > > ----- > > Reji Mathews > > Sr. Developer - Middleware Integration / SOA ( Open Source - Apache > Camel & Jboss Fuse ESB | Mule ESB ) > > LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a > > Twitter - reji_mathews > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/Camel-Simple-expressions-in-Groovy-tp5773187p5773294.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2nd edition: > https://www.manning.com/books/camel-in-action-second-edition > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://camel.465427.n5.nabble.com/Camel-Simple-expressions-in-Groovy-tp5773187p5773296.html > To unsubscribe from Camel Simple expressions in Groovy, click here > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5773187&code=Y29udGFjdHJlamlAZ21haWwuY29tfDU3NzMxODd8MTAwNDkxODIzMw==> > . > 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> > ----- Reji Mathews Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Simple-expressions-in-Groovy-tp5773187p5773301.html Sent from the Camel - Users mailing list archive at Nabble.com.