Joe Luo created CAMEL-7024:
------------------------------
Summary: Invoking removeEndpoints() api against a JmsEndpoint does
not remove associated Jms listener
Key: CAMEL-7024
URL: https://issues.apache.org/jira/browse/CAMEL-7024
Project: Camel
Issue Type: Bug
Components: camel-jms
Affects Versions: 2.10.3
Reporter: Joe Luo
I have a camel route that receives Camel Exchanges through JMS and based on its
content it builds on the fly the endpoint URI as a string. The URI comprises a
request queue and a response queue, and looks something similar to:
{code}
jms-test:queue:test.request?replyTo=test.response&replyToType=Exclusive&requestTimeout=20000&concurrentConsumers=1
{code}
This URI is then used on a *ReceipientList* which sends the JMS message.
Camel caches the above URI as one of its available endpoints, and registers a
listener (a DefaultMessageListenerContainer) against the response queue.
Client determines some of the parameters, for instance the timeout to be used.
If a new exchange for instance uses a different timeout, Camel would cache a
second endpoint with similar URI except for the timeout, and would create a
second JMS listener (DMLC) on the same response queue.
The above would create a conflict between the first listener and the second as
they would both compete for JMS response messages. For this reason I need to
remove the first endpoint using following Camel API:
{code}
Collection<Endpoint> removeEndpoints(String pattern) throws Exception;
{code}
For instance:
{code}
camelContext.removeEndpoints("jms-test*");
{code}
which successfully deletes it, but does not unsubscribe the JMS listener.
The reason is that when Camel removes the endpoint, it does not invoke stop()
on associated JmsProducer object which in turn calls unInitReplyManager() to
stop and destroy the DMLC that is created by ReplyManager for the response
queue.
--
This message was sent by Atlassian JIRA
(v6.1#6144)