I am using amqp-client-4.0.2
I have one topic exchange which routes messages to several queues
The queues are named in a x.x.x.x convention
My java client needs to be able to consume messages from several queues.
I would like to be able to do that in my spring config for example, to be able to specify a parameter, for example the routing key, or the name convention and the client to be able to consume messages from animal.orange.#
queues for example. Is this possible?
Asked
Active
Viewed 150 times
0

Gary Russell
- 166,535
- 14
- 146
- 179

The Strong Programmer
- 627
- 2
- 10
- 29
1 Answers
0
No, you cannot use wildcards for the queue names; you have to specify each queue fully.
EDIT
You could use the REST API to discover the queue names and dynamically configure the container.

Gary Russell
- 166,535
- 14
- 146
- 179
-
What about that? http://docs.spring.io/spring-amqp/reference/htmlsingle/#async-annotation-driven. There are several ways to listen to multiple queues actually – The Strong Programmer Mar 31 '17 at 14:29
-
Yes, of course, but you asked about using a wildcard, `animal.orange.#` - rabbitmq doesn't support such a notion; you have to configure each queue in the queues list. – Gary Russell Mar 31 '17 at 15:32
-
You are right. I cannot manage to get the payload right though @RabbitListener(queues = "#{'${rabbitmq.queues}'.split(',')}" ) public void processOrder(@Payload String data, @Header(AmqpHeaders.CONSUMER_QUEUE) String queue) { – The Strong Programmer Mar 31 '17 at 16:32