Hi Pay attention to how to use operators as documented http://camel.apache.org/simple
You need to have a single space before and after the operator. Do not use a dot. <simple>${in.body}.regex '^D1.*$'</simple> Should be <simple>${in.body} regex '^D1.*$'</simple> On Thu, Feb 3, 2011 at 1:30 PM, Xavier Coulon <xcou...@gmail.com> wrote: > Hello, > > I'm currently working with Camel (version 2.4.0-fuse-00-00, as provided in > Fuse ESB 4.3) to perform data integration from a file. The initial input is > a flat file which is splitted by line. > At one point, I have the following route : > > <choice> > <when> > <simple>${in.body}.regex '^D1.*$'</simple> > <to uri="seda:dataintegration.filtered.elements" /> > </when> > <otherwise> > <to uri="seda:dataintegration.ignored.elements" /> > </otherwise> > </choice> > > The goal of this route is to send line that begin with a "D1" to the uri > named "seda:dataintegration.filtered.elements", while the remaining elements > are not treated for now. They are sent to another uri, for logging purpose > in an output file. > > Hélas, all the messages are sent to > the "seda:dataintegration.filtered.elements" URI, whatever the beginning of > the line is (D0, D1, D2, etc.) > > In the output log of my test case, I have the following traces: > > 10:46:24.135 [Camel Thread 1 - seda://dataintegration.incoming.elements] > DEBUG o.a.camel.processor.SendProcessor - >>>> > Endpoint[seda://dataintegration.filtered.elements] Exchange[Message: D03xxx] > 10:46:24.135 [Camel Thread 2 - seda://dataintegration.filtered.elements] > DEBUG o.a.camel.processor.SendProcessor - >>>> > Endpoint[mock://test:filtered] Exchange[Message: D03xxx] > 10:46:24.135 [Camel Thread 2 - seda://dataintegration.filtered.elements] > DEBUG o.a.c.component.mock.MockEndpoint - mock://test:filtered >>>> 1 : > Exchange[Message: D03xxx] with body: D03xxx] > > My testcase uses of mock endpoint to catch the messages. In the traces > above, the "mock:filtered" endpoint received a message whose body starts > with D03 (I removed the remaining of the body as it is not relevant here). > > Any idea on what's wrong this my route definition ? > > Thank you in advance. > Regards, > > -- > Xavier > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/