Search code examples
transactionsrabbitmqamqpspring-amqp

SimpleMessageListenerContainer ChannelTransacted and MaxConcurrentConsumers


I'm trying to configure a SimpleMessageListenerContainer from Spring AMQP with channeled transactions to dynamically add consumers on demand. The problem is, I don't see consumers being added dynamically when I have a channeled transaction. To be clear, this doesn't dynamically add consumers under load:

container.setMaxConcurrentConsumers(5);
container.setChannelTransacted(true);
container.setTransactionManager(rabbitTransactionManager);

But this does:

container.setMaxConcurrentConsumers(5);
//container.setChannelTransacted(true);
//container.setTransactionManager(rabbitTransactionManager);

My questions are:

  1. Why aren't the consumers being added dynamically?
  2. Is there a workaround to get both channeled transactions and dynamic consumers to work?

Solution

    1. It's a bug - please open a JIRA issue.

    2. There is not a workaround, unfortunately; it needs a patch.

    The use of transactions with RabbitMQ is quite rare, especially on the consumer side - can you explain why you need them?