Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B57EF10AD6 for ; Fri, 6 Sep 2013 06:08:04 +0000 (UTC) Received: (qmail 39629 invoked by uid 500); 6 Sep 2013 06:08:03 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 39572 invoked by uid 500); 6 Sep 2013 06:08:03 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 39564 invoked by uid 99); 6 Sep 2013 06:08:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 06:08:03 +0000 X-ASF-Spam-Status: No, hits=0.3 required=5.0 tests=FREEMAIL_REPLY,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.172 as permitted sender) Received: from [209.85.223.172] (HELO mail-ie0-f172.google.com) (209.85.223.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 06:07:59 +0000 Received: by mail-ie0-f172.google.com with SMTP id c10so5952403ieb.31 for ; Thu, 05 Sep 2013 23:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=H8ehaGWAlAn1VMBzEhCF6FY87OxbJMfu+E6NuzTDTss=; b=RpMzBhk90lz69oA2D38z89L5MEUQ8F63r7CY8X5GaelqoP36Ecd0T620iSKMGZP18j jwoooiO9VZDk01KD3yJpYBCVXLnciEfIss/UrbKuK42pg4gg9G38RKsXs6H6mBx4KSqn NP0u4GdXqgFpoEwkr3lfPHK4thW/IG0jGwjTeuO8VwuYZaglc+sYIlCwWbx3o0N1r2qF 8v2zTPrd+e/dSvVBaou3ne6BX5eXos4UimMKeQX8YN6hhJSgmneZrivPQ7jRQVlMunLD 4wirZuQNgzG/NJgQ3UweJsLM+/4aFbEBlL+KDln/pfDxCKidbfikd17r2Eb+oyhgDDaw BQlQ== X-Received: by 10.50.73.74 with SMTP id j10mr8686368igv.50.1378447658812; Thu, 05 Sep 2013 23:07:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.20.196 with HTTP; Thu, 5 Sep 2013 23:07:17 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Fri, 6 Sep 2013 08:07:17 +0200 Message-ID: Subject: Re: CxfProducer cache problem on Camel To: "users@camel.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 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 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 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: clevers594@gmail.com -- Claus Ibsen ----------------- Red Hat, Inc. Email: cibsen@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen