You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Lachezar Dobrev <l....@gmail.com> on 2016/09/29 11:35:18 UTC

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.

Re: Messaging listener for local messages only

Posted by Martyn Taylor <mt...@redhat.com>.
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 <jb...@apache.com> 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" <l....@gmail.com>
> To: users@activemq.apache.org
> 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.
>

Re: Messaging listener for local messages only

Posted by Justin Bertram <jb...@apache.com>.
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" <l....@gmail.com>
To: users@activemq.apache.org
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.