Federico Mariani created CAMEL-27063:
----------------------------------------

             Summary: camel-jms - a topic consumer with concurrentConsumers > 1 
and no shared subscription processes every message once per consumer, with no 
warning
                 Key: CAMEL-27063
                 URL: https://issues.apache.org/jira/browse/CAMEL-27063
             Project: Camel
          Issue Type: Bug
          Components: camel-jms
            Reporter: Federico Mariani


A JMS consumer on a topic with {{concurrentConsumers}} (or 
{{maxConcurrentConsumers}}) greater than 1 and no shared subscription processes 
every message once per consumer. Spring's {{DefaultMessageListenerContainer}} 
creates one {{MessageConsumer}} per concurrent consumer, and on a topic each of 
them is a subscriber of its own.

{code:java}
from("jms:topic:orders?concurrentConsumers=3")
    .to("log:orders"); // each message sent to the topic is logged 3 times
{code}

The same happens when {{concurrentConsumers}} is set on the component (for its 
queue routes) and a route of that component consumes from a topic:

{code:java}
JmsComponent jms = JmsComponent.jmsComponentAutoAcknowledge(cf);
jms.setConcurrentConsumers(3);
context.addComponent("jms", jms);

from("jms:topic:orders").to("log:orders"); // 3 times as well
{code}

Nothing is logged, and the {{concurrentConsumers}} / {{maxConcurrentConsumers}} 
descriptions and the "Concurrent Consuming" section of the component page do 
not mention topics. With a non-shared durable subscription, the broker accepts 
only one of the consumers.

Expected: the behaviour stays as it is (it is what the JMS API does, and some 
brokers allow it with vendor settings), but the consumer logs a WARN when it 
starts, naming the topic and the options to use: {{subscriptionShared=true}} 
(JMS 2.0) with a {{subscriptionName}} so the consumers share one subscription, 
or a single consumer. The option descriptions and the component page say the 
same. This covers camel-activemq, camel-activemq6 and camel-amqp too, which use 
the camel-jms consumer.

_Claude Code on behalf of Federico Mariani_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to