You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Lars Storm (Systematic) (Jira)" <ji...@apache.org> on 2024/05/27 13:15:00 UTC
[jira] [Created] (CAMEL-20806) ProducerCache may reference producers from stopped endpoints
Lars Storm (Systematic) created CAMEL-20806:
-----------------------------------------------
Summary: ProducerCache may reference producers from stopped endpoints
Key: CAMEL-20806
URL: https://issues.apache.org/jira/browse/CAMEL-20806
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 4.4.1, 2.25.0
Reporter: Lars Storm (Systematic)
*Problem in short:*
The DefaultProducerCache created from .toD(...) in a route may reference producers created from endpoints that have been stopped.
Specifically the endpoint may have been stopped from camelContext.removeEndpoint(...)
*Proposal:*
ProducerCaches should be notified when an endpoint is stopped. The ProducerCache may then find and evict the leaked producer.
*Use case:*
In some cases we create a n endpoint (e.g. CxfEndpoint) programmatically per tenant (Multi-tenant setup) and store the endpoint in a non-Camel cache. The endpoint is then passed on to a Camel route on request.
The endpoint is then dynamically used in a .toD(...)
However the local cache may decide to stop the endpoint due to changes performed in tenant properties and create a new one. e.g. changing the endpoint url or similar.
In that case the TenantEndpointCache removes the current endpoint the camel context and creates a new one which is added to the context.
Example route code:
{noformat}
.setProperty("endpoint").method(TenantEndpointCache.class, "createEndpoint")
.toD("${exchangeProperty.endpoint}"){noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)