1
votes

My spring boot application's is functionality it to listen to the messages on rabbitmq queue, do some processing in onMessage, and then publish the message on another rabbitmq queue. We are using spring-rabbit (1.7.2.RELEASE). We have configured listener using SimpleMessageListenerContainer.

My question is can i publish using he same channel on which I am reading he messages. Does spring-rabbit provides access to channel used by listener? so that same channel can be reused to publish?

Thanks, Smita

1

1 Answers

0
votes

If you use transactions (listener container), any operations performed by a transactional RabbitTemplate on the container thread will participate in the transaction and use the same channel.

If you are not using transactions, you can use a ChannelAwareMessageListener to access the channel the message was received on. See Message Listeners.

If you are using @RabbitListener you can add the Channel as a method parameter.

The current 1.7.x release is 1.7.9.