Thanks for the suggestion but it's not what I need. Upon setting the option in the netty URI it complained with:
Caused by: java.lang.IllegalArgumentException: unsupported message type: class org.apache.camel.impl.DefaultExchangeHolder I actually found the error, we were doing: public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception { AbstractRequest req = (AbstractRequest) graph stream.write(req.toWireFormat().getBytes()); exchange.getIn().setHeader(REQ_COUNTER, req.counter); } but instead we should set the header in the *out* message and then in unmarshal(): exchange.getIn().getHeader(REQ_COUNTER, req.counter); problem solved, thanks for your time -- pica * Willem Jiang <willem.ji...@gmail.com> [20140112 12:54]: > Normally DataFormat marshall and unmarshall don???t take the exchange header > into consideration. > If your customer DataFormat does some work on the exchange header, you need > to set the transferExchange option to be true. > > > -- > Willem Jiang > > Red Hat, Inc. > Web: http://www.redhat.com > Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: ??????willem > > > > On January 12, 2014 at 2:43:35 AM, Joan Picanyol i Puig > (lists-ca...@biaix.org) wrote: > > > > Hi, > > > > We are integrating with a server which speaks an ASCII (but not > > line) > > based request-reply protocol over TCP sockets. Basic communication > > with > > a custom dataformat & netty looks OK and we'd like now to use a unique > > counter which is sent over the wire for all requests to verify > > received > > replies. > > > > Our test route looks like > > > > from("direct:a").marshal().custom("mydf") > > .to("netty:tcp://192.168.100.24:30303?encoder=#be&decoder=#bd&sync=true&requestTimeout=1000"). > > > > .unmarshal().custom("mydf").to("log:result"); > > > > We have tried is setting the counter as an exchange header in > > DataFormat.marshal() and validate it in DataFormat.unmarshal() > > but it is > > coming as null. > > > > We are ovbisouly misunderstanding what an Exchange is in this > > setup, > > could anyone give some clues? > > > > tks > > -- > > pica > > > -- pica