Why no using a consumer template [1]? For the transformation, I would use a custom type converter [2].
Than you could do something like: YourCustomBean bean = receiveBodyNoWait("file://...?fileName=foo.txt&noop=true", YourCustomBean.class); or if you need to access the exchange: Exchange exchange = receiveNoWait("file://...?fileName=foo.txt&noop=true"); if (exchange != null) { YourCustomBean bean = exchange.getIn().getBody(YourCustomBean.class); } Isn't it simple? [1] camel.apache.org/polling-consumer.html [2] http://camel.apache.org/type-converter.html Best, Christian On Sun, Jan 27, 2013 at 2:55 PM, helander <leh...@gmail.com> wrote: > I am trying to find a way to do: > > From a Producer Template send a request to a route, and in the route I > would > like to read the contents of a file, transform the contents and return back > to the producer template. > Location and name of file is fixed and the file should not be moved/removed > by the route. > If the specified file does not exist, the exchange should return without > waiting for the file to appear. > I tried using enrich/pollEnrich, but it seemed like I ended up having > produced a file with the contents of the inBody. > > Any suggestions on how to do this? > > Thanks > > Lars > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Reading-a-file-tp5726376.html > Sent from the Camel - Users mailing list archive at Nabble.com. > --