like" consumption on RabbitMq?
I'm new with RabbitMq and AMQP but I have some experience with ActiveMQ and JMS. I try to publish a message in a topic (topic like topic in JMS) and to consume this message from several listeners. For example, I publish a message saying there is a new user in the system, and there is one consumer to send an email to this user, and another consumer indexing this user in elasticsearch. So, each consume has to read the message until it can be deleted from the topic.
I tried to use a TopicExchange this way :
@Bean
public TopicExchange profileExchange() {
return new TopicExchange(PROFILE_EXCHANGE, true, false);
}
@Bean
public Queue putProfileQueue() {
return new Queue(this.PUT_PROFILE_QUEUE);
}
@Bean
public Binding putProfileBinding() {
return BindingBuilder.bind(putProfileQueue()).to(profileExchange()).with(PUT_PROFILE_QUEUE);
}
And I have two declared listeners.
But as soon as the first listener read the message, it is deleted from the queue and the second listener don't read the message.
I'm not sure to understand correctly the different AMQP configuration and which one I should use to mimic the "topic" pattern I used to know in JMS.
You would use a fanout
exchange - each consumer needs its own queue bound to the exchange.
See the tutorials.
链接地址: http://www.djcxy.com/p/34214.html上一篇: 用于多个队列的RabbitMQ配置
下一篇: 像“在RabbitMq上消费?