RabbitMQ pub sub sending message twice almost.

614 views
Skip to first unread message

Mahesh Vedantam

unread,
Dec 10, 2016, 3:07:33 PM12/10/16
to rabbitmq-users
Hi Rabbit MQ users,

I am try to use pub-sub model and new to rabbit mq.
In my test project, the publishers send an event it gets delivered almost twice to the event handler.
I am not what causing the events to be delivered more than once ( Does the SimpleMessageListenerContainer gets called once the handleRequest in MQ Event Handler is completed). Please let me know.

Here is the configuration:-
[snip]
<fanout-exchange name="broadcast.responses" xmlns="http://www.springframework.org/schema/rabbit">
<bindings>
<!-- Bind a fanout to an anonymous queue unique for this node, then all nodes in a cluster get the same response -->
<binding queue="myQueue" />
</bindings>
</fanout-exchange>
<rabbit:listener-container connection-factory="connectionFactory">
<rabbit:listener ref="myEventHandler" method="handleRequest" queue-names="myQueue" />
</rabbit:listener-container>
Thanks,
Mahesh.

Michael Klishin

unread,
Dec 10, 2016, 3:10:29 PM12/10/16
to rabbitm...@googlegroups.com, Mahesh Vedantam
Spring AMQP questions belong to Stack Overflow with the tag “spring-amqp”. You use
a fanout exchange: it places a copy of every message into every queue that’s bound to it.
That’s the most likely reason for confusion. Redeliveries would be another.

Both are quite easy to verify using the management UI or `rabbitmqctl list_*` commands.

On 10 December 2016 at 23:07:38, Mahesh Vedantam (mahesh....@gmail.com) wrote:
> Hi Rabbit MQ users,
>
> I am try to use pub-sub model and new to rabbit mq.
> In my test project, the publishers send an event it gets delivered almost
> twice to the event handler.
> I am not what causing the events to be delivered more than once ( Does the
> SimpleMessageListenerContainer gets called once the handleRequest in MQ
> Event Handler is completed). Please let me know.
>
> Here is the configuration:-
> [snip]
> > xmlns="http://www.springframework.org/schema/rabbit">
>
>
>
>
>
>
> > queue-names="myQueue" />
>
> Thanks,
> Mahesh.
>
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


KH

unread,
Dec 10, 2016, 3:16:30 PM12/10/16
to rabbitmq-users
Mahesh,
Can you check within your config file, it may be that within the ListenerContainerLifecycleManager config, you might be calling "registerCluster". Since the terminal will register a cluster, this means your cluster is registered with a ListenerContainer twice. Axon will reuse the same container, causing a message to be downloaded twice. But since the Cluster is subscribed twice, it will receive messages twice.

Removing the call to "registerCluster should resolve the issue. Let me know if you still have any issues, and if so if you can, share the config file to further exam.

Thanks,
KH

Michael Klishin

unread,
Dec 11, 2016, 6:54:39 AM12/11/16
to Mahesh Vedantam, rabbitm...@googlegroups.com
+rabbitmq-users. I do not offer 1-on-1 support of any kind.

I do not understand the question, sorry. 

On Sun, Dec 11, 2016 at 7:26 AM, Mahesh Vedantam <mahesh....@gmail.com> wrote:
Hi Mike,

Thanks for the response.
Is there any way to control the event handler calling incase of undeliver messages and use of fanout exchange.

Thanks,
Uma Mahesh.


On Sun, Dec 11, 2016 at 1:40 AM, Michael Klishin <mkli...@pivotal.io> wrote:
Spring AMQP questions belong to Stack Overflow with the tag “spring-amqp”. You use
a fanout exchange: it places a copy of every message into every queue that’s bound to it.
That’s the most likely reason for confusion. Redeliveries would be another.

Both are quite easy to verify using the management UI or `rabbitmqctl list_*` commands.

On 10 December 2016 at 23:07:38, Mahesh Vedantam (mahesh....@gmail.com) wrote:
> Hi Rabbit MQ users,
>
> I am try to use pub-sub model and new to rabbit mq.
> In my test project, the publishers send an event it gets delivered almost
> twice to the event handler.
> I am not what causing the events to be delivered more than once ( Does the
> SimpleMessageListenerContainer gets called once the handleRequest in MQ
> Event Handler is completed). Please let me know.
>
> Here is the configuration:-
> [snip]
> > xmlns="http://www.springframework.org/schema/rabbit">
>
>
>
>
>
>
> > queue-names="myQueue" />
>
> Thanks,
> Mahesh.
>
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.

> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Mahesh Vedantam

unread,
Dec 11, 2016, 9:54:26 AM12/11/16
to Michael Klishin, rabbitm...@googlegroups.com
Thanks for the response.
I want to check if the re delivery of messages can be configuration via XML or not when there is error/exception.

Thanks again,
Mahesh.

Reply all
Reply to author
Forward
0 new messages