I am trying to use Spring AMQP with RabbitMQ for processing messages within my notification application. I have a fanout exchange, which sends messages to two queues. The problem is, when the message is consumed, I need to know what queue the message came from. Is there a way to expose the queue name to my MessageListener? I have been unable to find out how to access the queue name from anywhere in the stack, given the configuration below. I'd be fine with having to use AOP to somehow inject the name back into message, if that is even possible.
Any help would be greatly appreciated!
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd"> <rabbit:connection-factory id="connectionFactory" host="some.host.com" port="5762" username="exampleUsername" password="examplePassword" channel-cache-size="20" /> <rabbit:listener-container connection-factory="connectionFactory" concurrency="5" acknowledge="auto" auto-startup="true"> <rabbit:listener queue-names="comment_action,like_action,follow_action,cache_management,user_management,error_action,facebook_action" ref="amqpMessageListener"/> </rabbit:listener-container>