Messaging listener for local messages only

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Messaging listener for local messages only

Lachezar Dobrev
  I have a multi-node (static) network of embedded Artemis JMS brokers.
  I'm wondering if there is a way to register a JMS listener to a topic,
but somehow distinguish between messages sent via the local broker and
those that come from different nodes in the 'cluster'?
  I'd like to make sure, that the specific listener only handles messages
sent from producers connected to the same broker.
Reply | Threaded
Open this post in threaded view
|

Re: Messaging listener for local messages only

Justin Bertram-2
I see a couple of options off the top of my head:

  1) Make sure "messages sent via the local broker" have a unique, consistent property and simply create your topic subscription to select those messages.

  2) Modify your cluster-connection configuration so that the topic in question isn't clustered.


Justin

----- Original Message -----
From: "Lachezar Dobrev" <[hidden email]>
To: [hidden email]
Sent: Thursday, September 29, 2016 6:35:18 AM
Subject: Messaging listener for local messages only

  I have a multi-node (static) network of embedded Artemis JMS brokers.
  I'm wondering if there is a way to register a JMS listener to a topic,
but somehow distinguish between messages sent via the local broker and
those that come from different nodes in the 'cluster'?
  I'd like to make sure, that the specific listener only handles messages
sent from producers connected to the same broker.
Reply | Threaded
Open this post in threaded view
|

Re: Messaging listener for local messages only

Martyn Taylor
I'd start with Justin's suggestions, if those are not possible it might be
possible add an outbound interceptor that increments a message property
with a counter "NUMBER_OF_HOPS".  It would get triggered every time the
message is forwarded to a broker or client.  This way you can figure out
how many hops the messages has had.  1 means local broker, >1 means a
remote broker.





On Thu, Sep 29, 2016 at 2:23 PM, Justin Bertram <[hidden email]> wrote:

> I see a couple of options off the top of my head:
>
>   1) Make sure "messages sent via the local broker" have a unique,
> consistent property and simply create your topic subscription to select
> those messages.
>
>   2) Modify your cluster-connection configuration so that the topic in
> question isn't clustered.
>
>
> Justin
>
> ----- Original Message -----
> From: "Lachezar Dobrev" <[hidden email]>
> To: [hidden email]
> Sent: Thursday, September 29, 2016 6:35:18 AM
> Subject: Messaging listener for local messages only
>
>   I have a multi-node (static) network of embedded Artemis JMS brokers.
>   I'm wondering if there is a way to register a JMS listener to a topic,
> but somehow distinguish between messages sent via the local broker and
> those that come from different nodes in the 'cluster'?
>   I'd like to make sure, that the specific listener only handles messages
> sent from producers connected to the same broker.
>