Hi Ah yeah read from a file and a file does not include any headers when you write to a file. The body is the content of the file. And all headers is not stored. You need to do some kind of custom message transformation if you want to include headers, and also when you read the file. eg where should the headers be stored in the file?
On Sat, Oct 3, 2015 at 2:33 PM, David Hoffer <dhoff...@gmail.com> wrote: > We add the headers where we create and/or call process on the routing > slip... > > exchange.getIn().setHeader("customHeader1", somedata1); > exchange.getIn().setHeader("customHeader2", somedata2); > exchange.getIn().setHeader(routingSlipHeaderName, toUris); > routingSlip.process(exchange); > > But then when when the message is handled by a processor bean we try to get > the header back via > > String data1 = (String) exchange.getIn().getHeader("customHeader1"); > > This always returns null and it removed the 'routingSlipHeaderName' header > too that used used by the routing slip. (Its okay that it removed this > one...but need the others.) > > Here is the XML config for the receiving route. The CopyFileProcessor is > the one that does not get the custom headers. > > <bean id="backupProcessor" > class="com.issinc.jms.gangplank.impl.CopyFileProcessor"> > <property name="path" value="${gp.camel.backup.dir}"/> > </bean> > > <routeContext id="backup-endpoint" > xmlns="http://camel.apache.org/schema/spring"> > <route id="to_backup" autoStartup="{{gp.camel.backup.isConfigured}}"> > <from > uri="file://{{gangplank.data}}/toBackup/?delete=true&moveFailed=.error&filter=#partialFilter&delay=200"/> > <process ref="backupProcessor" /> > <onException redeliveryPolicyRef="redeliveryProfile"> > <exception>java.lang.Exception</exception> > <handled> > <constant>false</constant> > </handled> > </onException> > </route> > </routeContext> > > > > > -Dave > > On Sat, Oct 3, 2015 at 2:27 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > >> Where do you set those custom headers? >> >> On Fri, Oct 2, 2015 at 8:20 PM, David Hoffer <dhoff...@gmail.com> wrote: >> > I'm using a RoutingSlip to route files but all custom headers set on the >> > Exchange are discarded. I assume that's because Camel assumes custom >> > headers are not useful for file messages but I need a way to pass source >> > information from the RoutingSlip to the file Processors. >> > >> > How can I do this? Is there a way I can override the default behavior of >> > removing all custom headers? >> > >> > -Dave >> >> >> >> -- >> Claus Ibsen >> ----------------- >> http://davsclaus.com @davsclaus >> Camel in Action 2nd edition: >> https://www.manning.com/books/camel-in-action-second-edition >> -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition