Hi

The url is the same in the endpoint(url) so you get the same instance.
And then afterwards you set the custom cxf binding. You need 2
different urls, so its 2 different endpoint instances. Or you can
crate the cxf endpoints using java code, with the new constructor.

On Fri, Sep 6, 2013 at 5:36 AM, liugang594 Liu <clevers...@gmail.com> wrote:
> Hi All:
>
> I found the CxfProducer object will be cached to reuse in Camel, however
> this may can's suatable for any time, to make things simple, assume we have
> below route:
>
> class CustomDefaultCxfBinding extends DefaultCxfBinding {
> private String a;
> public CustomDefaultCxfBinding(String a) {
> this.a = a;
> setHeaderFilterStrategy(new CxfHeaderFilterStrategy());
> }
>
> @Override
> public void populateCxfRequestFromExchange(org.apache.cxf.message.Exchange
> cxfExchange,
> Exchange camelExchange, Map<String, Object> requestContext) {
> System.out.println(a);
> super.populateCxfRequestFromExchange(cxfExchange,camelExchange,
> requestContext);
> }
> }
>
> String url = "...";
> CxfEndpoint cxfEndpoint1 = (CxfEndpoint) endpoint(url);
> cxfEndpoint1.setCxfBinding(new CustomDefaultCxfBinding("a1"));
>  CxfEndpoint cxfEndpoint2 = (CxfEndpoint) endpoint(url);
> cxfEndpoint2.setCxfBinding(new CustomDefaultCxfBinding("a2"));
>
> from("timer:foo?repeatCount=1") .setBody(constant(content)).to(cxfEndpoint1)
> .setBody(constant(content)).to(cxfEndpoint2);
>
>
> both "a1" and "a2" are expected to be printed, but only "a2" for now.
>
> Does anybody knows how to handle this situation?
> Thanks alot
>
>
> --
> Thanks
> GangLiu
> Mail: clevers...@gmail.com



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to