Durable subscribers (for topic) and Network of brokers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Durable subscribers (for topic) and Network of brokers

paddycarman
Seeking the experts help here.

I have 2 brokers - A and B - connected as networks of brokers configuration
using network connectors.

P ------------ A -----B-------------C

There is one publisher P connected to A that published to topic
/topic/foo/bar. I also have a durable subscriber C for the topic.
Initially C is connected to B. When P publishes message "hello1" to the
topic, C receives the message. Now C disconnects from B and connects to A
and subscribes to the same topic. Weird thing is that C received the same
message "hello1" again.

Question: Is it weird or is it the expected behavior? How can I avoid C
from getting messages that it had already received (when it connected to a
different broker earlier)?

I have tested this with MQTT (cleansession=0, clientid set) as well as
STOMP (client-id and activemq.subscriptionName values set). Both have the
same behavior.

Appreciate your help!

Thanks,
PC
Reply | Threaded
Open this post in threaded view
|

Re: Durable subscribers (for topic) and Network of brokers

paddycarman
Forgot to mention that consumer C uses the same client-id when connecting
to broker B and A.


On Mon, Jun 2, 2014 at 3:43 PM, Paddy Carman <[hidden email]> wrote:

> Seeking the experts help here.
>
> I have 2 brokers - A and B - connected as networks of brokers
> configuration using network connectors.
>
> P ------------ A -----B-------------C
>
> There is one publisher P connected to A that published to topic
> /topic/foo/bar. I also have a durable subscriber C for the topic.
> Initially C is connected to B. When P publishes message "hello1" to the
> topic, C receives the message. Now C disconnects from B and connects to A
> and subscribes to the same topic. Weird thing is that C received the same
> message "hello1" again.
>
> Question: Is it weird or is it the expected behavior? How can I avoid C
> from getting messages that it had already received (when it connected to a
> different broker earlier)?
>
> I have tested this with MQTT (cleansession=0, clientid set) as well as
> STOMP (client-id and activemq.subscriptionName values set). Both have the
> same behavior.
>
> Appreciate your help!
>
> Thanks,
> PC
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Durable subscribers (for topic) and Network of brokers

ceposta
In reply to this post by paddycarman
Does C connect (or did it connect previously) to A to establish that
durable subscription on A? Or is that durable sub staying around somehow on
A?


On Mon, Jun 2, 2014 at 3:43 PM, Paddy Carman <[hidden email]> wrote:

> Seeking the experts help here.
>
> I have 2 brokers - A and B - connected as networks of brokers configuration
> using network connectors.
>
> P ------------ A -----B-------------C
>
> There is one publisher P connected to A that published to topic
> /topic/foo/bar. I also have a durable subscriber C for the topic.
> Initially C is connected to B. When P publishes message "hello1" to the
> topic, C receives the message. Now C disconnects from B and connects to A
> and subscribes to the same topic. Weird thing is that C received the same
> message "hello1" again.
>
> Question: Is it weird or is it the expected behavior? How can I avoid C
> from getting messages that it had already received (when it connected to a
> different broker earlier)?
>
> I have tested this with MQTT (cleansession=0, clientid set) as well as
> STOMP (client-id and activemq.subscriptionName values set). Both have the
> same behavior.
>
> Appreciate your help!
>
> Thanks,
> PC
>



--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Reply | Threaded
Open this post in threaded view
|

Re: Durable subscribers (for topic) and Network of brokers

paddycarman
Thanks Christian. You are correct. C had connected to A before. The
scenario is that A and B are behind a load-balancer. When C connects
through a load balancer, it can be connected to either of the brokers. It
seems like VirtualTopics is a solution if subscribers can consume from
queues. For example, with STOMP I was able to overcome this issue using a
VirtualTopic for Publisher P and a related queue for the consumer C. But my
subscribers are using MQTT and can consume only from topics. Is there a
solution in this case?
Thanks,
PC


On Wed, Jun 4, 2014 at 10:18 AM, Christian Posta <[hidden email]>
wrote:

> Does C connect (or did it connect previously) to A to establish that
> durable subscription on A? Or is that durable sub staying around somehow on
> A?
>
>
> On Mon, Jun 2, 2014 at 3:43 PM, Paddy Carman <[hidden email]>
> wrote:
>
> > Seeking the experts help here.
> >
> > I have 2 brokers - A and B - connected as networks of brokers
> configuration
> > using network connectors.
> >
> > P ------------ A -----B-------------C
> >
> > There is one publisher P connected to A that published to topic
> > /topic/foo/bar. I also have a durable subscriber C for the topic.
> > Initially C is connected to B. When P publishes message "hello1" to the
> > topic, C receives the message. Now C disconnects from B and connects to A
> > and subscribes to the same topic. Weird thing is that C received the same
> > message "hello1" again.
> >
> > Question: Is it weird or is it the expected behavior? How can I avoid C
> > from getting messages that it had already received (when it connected to
> a
> > different broker earlier)?
> >
> > I have tested this with MQTT (cleansession=0, clientid set) as well as
> > STOMP (client-id and activemq.subscriptionName values set). Both have the
> > same behavior.
> >
> > Appreciate your help!
> >
> > Thanks,
> > PC
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>
Reply | Threaded
Open this post in threaded view
|

Re: Durable subscribers (for topic) and Network of brokers

ceposta
Durable topics (JMS) in full mesh of network of brokers kinda sucks right
now as you've seen. Some workarounds right now include evicting the durable
sub after some period of time, but that may not be suitable for all
solutions. I think given the nature of MQTT, we should reconsider some of
how this is done. I saw you opened the JIRA. Feel free to also dive in and
see if there's a patch you could contribute or start up.


On Wed, Jun 4, 2014 at 11:42 AM, Paddy Carman <[hidden email]>
wrote:

> Thanks Christian. You are correct. C had connected to A before. The
> scenario is that A and B are behind a load-balancer. When C connects
> through a load balancer, it can be connected to either of the brokers. It
> seems like VirtualTopics is a solution if subscribers can consume from
> queues. For example, with STOMP I was able to overcome this issue using a
> VirtualTopic for Publisher P and a related queue for the consumer C. But my
> subscribers are using MQTT and can consume only from topics. Is there a
> solution in this case?
> Thanks,
> PC
>
>
> On Wed, Jun 4, 2014 at 10:18 AM, Christian Posta <
> [hidden email]>
> wrote:
>
> > Does C connect (or did it connect previously) to A to establish that
> > durable subscription on A? Or is that durable sub staying around somehow
> on
> > A?
> >
> >
> > On Mon, Jun 2, 2014 at 3:43 PM, Paddy Carman <[hidden email]>
> > wrote:
> >
> > > Seeking the experts help here.
> > >
> > > I have 2 brokers - A and B - connected as networks of brokers
> > configuration
> > > using network connectors.
> > >
> > > P ------------ A -----B-------------C
> > >
> > > There is one publisher P connected to A that published to topic
> > > /topic/foo/bar. I also have a durable subscriber C for the topic.
> > > Initially C is connected to B. When P publishes message "hello1" to the
> > > topic, C receives the message. Now C disconnects from B and connects
> to A
> > > and subscribes to the same topic. Weird thing is that C received the
> same
> > > message "hello1" again.
> > >
> > > Question: Is it weird or is it the expected behavior? How can I avoid C
> > > from getting messages that it had already received (when it connected
> to
> > a
> > > different broker earlier)?
> > >
> > > I have tested this with MQTT (cleansession=0, clientid set) as well as
> > > STOMP (client-id and activemq.subscriptionName values set). Both have
> the
> > > same behavior.
> > >
> > > Appreciate your help!
> > >
> > > Thanks,
> > > PC
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>



--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Reply | Threaded
Open this post in threaded view
|

Re: Durable subscribers (for topic) and Network of brokers

Márcio M
Any advance on this topic? I'm facing the same issue on ActiveMQ 5.15 (2017)
and I couldn't find any solution throughout this mailing list.

Thanks in advance,

Márcio



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Durable subscribers (for topic) and Network of brokers

Tim Bain
https://issues.apache.org/jira/browse/AMQ-5290 sounds like it should have
eliminated this issue, but the fact that you're seeing this using MQTT (or
are you using STOMP?) on 5.15.0 means something else is going on.

One question: have you enabled conduitSubscriptions between A and B?

Tim

On Sep 28, 2017 11:48 AM, "Márcio M" <[hidden email]> wrote:

> Any advance on this topic? I'm facing the same issue on ActiveMQ 5.15
> (2017)
> and I couldn't find any solution throughout this mailing list.
>
> Thanks in advance,
>
> Márcio
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>