You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Prashanth Babu <pr...@gmail.com> on 2022/05/11 07:11:01 UTC

Apache Artemis Broker Clustering with MQTT - 2 way communication

Hi all,

I'd like to know if I could create a cluster of Artemis nodes via a
kubernetes deployment and use it as an MQTT broker for 2 way communication.

The idea is to create a cluster of say 3 nodes and place it behind a load
balancer. Now clients can connect to any one of the 3 nodes ( N1,N2,N3 )
based on load balancer distribution.

Let's assume a client C1 has connected to node N1 and published to topic T1
Also assume a client C2 has connected to node N2 and subscribed to topic T1

Would C2 get the message from C1 ?

I wasn't able to find a suitable document on achieving this kind of
clustering for MQTT using kubernetes.

Thanks,
Prashanth

Re: Apache Artemis Broker Clustering with MQTT - 2 way communication

Posted by Prashanth Babu <pr...@gmail.com>.
Thank you so much  Domenico & Justin for this information . This helps!

On Thu, May 12, 2022 at 12:15 AM Justin Bertram <jb...@apache.org> wrote:

> If you are going to use a load-balancer for MQTT clients and your use-case
> includes using "dirty" sessions then I would strongly suggest using the
> connection router [1] functionality from ActiveMQ Artemis and routing based
> on client ID. This is because cluster nodes don't share MQTT session state
> so an MQTT client's state will exist only on one particular cluster node.
> Therefore, if your clients ever want to connect back to their session (e.g.
> to resume their previous subscriptions) they will need to connect back to
> node where they were previously connected and using a connection router is
> a great way to do that.
>
>
> Justin
>
> [1]
>
> https://activemq.apache.org/components/artemis/documentation/latest/connection-routers.html
>
> On Wed, May 11, 2022 at 2:11 AM Prashanth Babu <pr...@gmail.com>
> wrote:
>
> > Hi all,
> >
> > I'd like to know if I could create a cluster of Artemis nodes via a
> > kubernetes deployment and use it as an MQTT broker for 2 way
> communication.
> >
> > The idea is to create a cluster of say 3 nodes and place it behind a load
> > balancer. Now clients can connect to any one of the 3 nodes ( N1,N2,N3 )
> > based on load balancer distribution.
> >
> > Let's assume a client C1 has connected to node N1 and published to topic
> T1
> > Also assume a client C2 has connected to node N2 and subscribed to topic
> T1
> >
> > Would C2 get the message from C1 ?
> >
> > I wasn't able to find a suitable document on achieving this kind of
> > clustering for MQTT using kubernetes.
> >
> > Thanks,
> > Prashanth
> >
>

Re: Apache Artemis Broker Clustering with MQTT - 2 way communication

Posted by Justin Bertram <jb...@apache.org>.
If you are going to use a load-balancer for MQTT clients and your use-case
includes using "dirty" sessions then I would strongly suggest using the
connection router [1] functionality from ActiveMQ Artemis and routing based
on client ID. This is because cluster nodes don't share MQTT session state
so an MQTT client's state will exist only on one particular cluster node.
Therefore, if your clients ever want to connect back to their session (e.g.
to resume their previous subscriptions) they will need to connect back to
node where they were previously connected and using a connection router is
a great way to do that.


Justin

[1]
https://activemq.apache.org/components/artemis/documentation/latest/connection-routers.html

On Wed, May 11, 2022 at 2:11 AM Prashanth Babu <pr...@gmail.com>
wrote:

> Hi all,
>
> I'd like to know if I could create a cluster of Artemis nodes via a
> kubernetes deployment and use it as an MQTT broker for 2 way communication.
>
> The idea is to create a cluster of say 3 nodes and place it behind a load
> balancer. Now clients can connect to any one of the 3 nodes ( N1,N2,N3 )
> based on load balancer distribution.
>
> Let's assume a client C1 has connected to node N1 and published to topic T1
> Also assume a client C2 has connected to node N2 and subscribed to topic T1
>
> Would C2 get the message from C1 ?
>
> I wasn't able to find a suitable document on achieving this kind of
> clustering for MQTT using kubernetes.
>
> Thanks,
> Prashanth
>

Re: Apache Artemis Broker Clustering with MQTT - 2 way communication

Posted by Domenico Francesco Bruscino <br...@gmail.com>.
Hi Prashanth,

ActiveMQ Artemis clusters support message load balancing [1] on demand by
default, see the MQTT Clustered Subscription Example [2].

To deploy an ActiveMQ Artemis cluster on Kubernetes I would take a look to
ArtemiCloud.io <https://artemiscloud.io/> [3]

[1]
https://activemq.apache.org/components/artemis/documentation/latest/clusters.html
[2]
https://github.com/apache/activemq-artemis/tree/main/examples/protocols/mqtt/clustered-queue-mqtt
[3] https://artemiscloud.io/

Regards,
Domenico

On Wed, 11 May 2022 at 09:11, Prashanth Babu <pr...@gmail.com>
wrote:

> Hi all,
>
> I'd like to know if I could create a cluster of Artemis nodes via a
> kubernetes deployment and use it as an MQTT broker for 2 way communication.
>
> The idea is to create a cluster of say 3 nodes and place it behind a load
> balancer. Now clients can connect to any one of the 3 nodes ( N1,N2,N3 )
> based on load balancer distribution.
>
> Let's assume a client C1 has connected to node N1 and published to topic T1
> Also assume a client C2 has connected to node N2 and subscribed to topic T1
>
> Would C2 get the message from C1 ?
>
> I wasn't able to find a suitable document on achieving this kind of
> clustering for MQTT using kubernetes.
>
> Thanks,
> Prashanth
>