Reputation: 585
I'm working on a Java application which uses Spring Boot version 2.0.4.RELEASE and RabbitMQ version 3.7.7. The app is caching all the messages from the RabbitMQ in Redis database and has to resend when a new Queue is created in RabbitMQ. Currently, I managed to capture the Queue creation using Event Exchange Plugin and also the Queue name. I am using AMQP outbound adapter to send the messages back to RabbitMQ.
OutFlow
public IntegrationFlow outFlow(AmqpTemplate amqpTemplate) {
return IntegrationFlows.from(outputChannel())
.handle(Amqp.outboundAdapter(amqpTemplate)
.routingKeyExpression("headers.routingKey")
.exchangeNameExpression("headers.exchange"))
.get();
}
I can send the messages to specific exchange with the routingKey. But, I don't know how to configure the Queue name in the outbound adapter. So that I can send the message to that specific Queue.
Upvotes: 8
Views: 1481
Reputation: 121552
If you want to send to the specific queue, use the queue name for the routing key and default global exchange - empty name. There is one special direct exchange which has all the queue bound to it by their names as routing keys.
See AMQP protocol docs for more info: https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchange-default
Upvotes: 0