Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0E21B200C41 for ; Thu, 9 Mar 2017 08:26:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0AE3B160B64; Thu, 9 Mar 2017 07:26:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5AC72160B67 for ; Thu, 9 Mar 2017 08:26:45 +0100 (CET) Received: (qmail 21394 invoked by uid 500); 9 Mar 2017 07:26:44 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 21377 invoked by uid 99); 9 Mar 2017 07:26:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Mar 2017 07:26:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D067B1A071D for ; Thu, 9 Mar 2017 07:26:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.452 X-Spam-Level: * X-Spam-Status: No, score=1.452 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8V9vN419_-uP for ; Thu, 9 Mar 2017 07:26:42 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id B7F495F64B for ; Thu, 9 Mar 2017 07:26:41 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 3C53BE044C for ; Thu, 9 Mar 2017 07:26:38 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id EB8B42437F for ; Thu, 9 Mar 2017 07:26:37 +0000 (UTC) Date: Thu, 9 Mar 2017 07:26:37 +0000 (UTC) From: "Dan Rivett (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-10972) ProducerCache uses Endpoint.getEndpointUri() as key which isn't always unique! MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 09 Mar 2017 07:26:46 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15902608#comment-15902608 ] Dan Rivett commented on CAMEL-10972: ------------------------------------ Yes I just saw that between 2.17.5 and 2.18.0 the camel-context pom.xml was updated to include '(deprecated)' in the name so I guess it was deprecated in 2.18 but I didn't see it in the 2.18 [release notes|http://camel.apache.org/camel-2180-release.html] or on the component page linked above. I would recommend and appreciate an update the component page above to indicate its deprecation and what the recommended alternative is ({{vm}} or {{direct-vm}}?) > ProducerCache uses Endpoint.getEndpointUri() as key which isn't always unique! > ------------------------------------------------------------------------------ > > Key: CAMEL-10972 > URL: https://issues.apache.org/jira/browse/CAMEL-10972 > Project: Camel > Issue Type: Bug > Affects Versions: 2.16.1 > Reporter: Dan Rivett > Assignee: Claus Ibsen > > Found in 2.16.1 (I can't upgrade yet due to it being run in a legacy Spring 3.2 environment) but it looks to still be present in the current codebase from viewing the master branch. > h3. Background > When referencing direct endpoints from a different context using the uri {{context:endpointUri}} such as the following: > {code} > > > > > > > > {code} > This works fine. > However swap to a {{RecipientList}} and it fails: > {code} > > > > context-a:notifyProcessingFailedRoute,context-b:notifyProcessingFailedRoute > > >
myRecipientListHeader
>
>
> {code} > h3. Investigation > This appears to be due to {{ProducerCache}} caching by {{Endpoint.getEndpointUri()}} which in the case of a {{DirectEndpoint}} both the recipients in the list return the same ({{direct://notifyProcessingFailedRoute}} value in the example above). {{ProducerCache}} is called by {{RecipientListProcessor}} [here|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/processor/RecipientListProcessor.java#L202]. Note: the {{endpoint}} variable two lines above resolves to the correct {{Endpoint}} it is the {{Producer}} which is resolved (via cache) incorrectly. > Now I don't know the Camel codebase well enough to say if {{DirectEndpoint.getEndpointUri()}} should return ambiguous URIs in multi-Camel-Context environments, or whether {{ProducerCache.doGetProducer()}} (see [here|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java#L564]) should use a key like something as follows to use a cache key that takes into account the {{Endpoint}}'s Camel Context: > {code} > String key = endpoint.getCamelContext().getName() + "_" + endpoint.getEndpointUri(); > {code} > This seems over-simplistic because endpoints that aren't Camel Context specific such as JMS could be in the cache multiple times, but at least the correct {{Endpoint}} would be returned from the cache each time, unlike now. > h3. Workarounds > 1. Use different endpoint uris (e.g. prepend context name). > 2. Supply the Recipient List with Endpoints rather than Strings to avoid parsing the URIs into Endpoints and running into this issue (see [this line|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java#L87]). Seems a bit of a hack. -- This message was sent by Atlassian JIRA (v6.3.15#6346)