With Bean Binding, the result of the method is set as the Exchange's out
message body.

In fact, Bean Binding is designed to allow you to leverage your existing
business POJOs which are Camel-agnostic to inject business logic into your
route. So you never really need to manipulate the Exchange yourself. Camel
will take care of doing the right thing.

I guess you are confusing using processors with using beans. In processors,
you have to explicitly manipulate the Exchange yourself. With bean binding,
the return value of the method is automatically set on the exchange. Check
out [1], which explains the rules of the game ;)

Hope this helps.

Regards,
Raúl.

[1] http://camel.apache.org/bean-binding.html.

On 16 December 2011 19:03, ebinsingh <ebenezer.si...@verizonwireless.com>wrote:

> I am assuming that unless I set the body of the exchange to what is
> processed
> by the bean called within the interceptor, the exchange should not change.
> Is this not true?
>
> All my bean does is return and object. But it's affecting the exchange.
>
> /       public MarsTracerEntity traceExchange(Exchange exchange) throws
> Exception
> {
>                MarsTracerEntity entity = new MarsTracerEntity();
>                if(null != exchange.getIn().getHeader("CamelFileNameOnly"))
>
>
> entity.setInputFileName((String)exchange.getIn().getHeader("CamelFileNameOnly"));
>                if(null != exchange.getIn().getHeader("CamelBatchSize"))
>
> entity.setBatchSize((Integer)exchange.getIn().getHeader("CamelBatchSize"));
>                if(null != exchange.getIn().getHeader("breadcrumbId"))
>
>
> entity.setOutputFileName((String)exchange.getIn().getHeader("breadcrumbId"));
>
>                log.info("InputFilename  5555 :
> "+entity.getInputFileName());
>                log.info("outputFilename  2222 :
> "+entity.getOutputFileName());
>                log.info("Batch  1111 : "+entity.getBatchSize());
>
>                return entity;
>        }/
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Intercept-issue-need-help-tp5080816p5081107.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to