[activemq-user] Multiple similar subscribers

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

[activemq-user] Multiple similar subscribers

Peter Gelderbloem

Hi,

First off, thanks for such an amazingly simple to use, yet powerful
tool.

I have a situation where I have a Topic with multiple instances of a
subscriber. How do I make sure that message A only gets "consumed" once
by only one instance of the subscriber group?
Basically
1)message A goes into topic.
2)message B goes into topic
3)subscriber 4 from group alpha "consumes" message A in a way that no
other subscriber from group alpha can ever "consume" message A again.
4)subscriber 2 from group alpha "consumes" message B in a way that no
other subscriber from group alpha can ever "consume" message B again.
After this sequence, Message A and B should still be available to
subscribers not in group alpha.

Thanks in advance,
Peter Gelderbloem

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-user] Multiple similar subscribers

Yogesh Prajapati
To me it looks like you are trying to follow p2p model using "Topic". In my
opinion you should be using "Queue" as destination instead and have all your
JMS client (receivers) act as message consumer of the "Queue" (not a
subscriber to the "Topic"). This assures that one message is consumed only
and only once by one consumer. Further, you could use a separate "Message
Selector" (a sql query like string) for each group of consumer.

At the end, I did not understand your need of ensuring the availiability of
the messages to the "subscribers" after they consumed by one particular
group of consumers (in your case the group is Alpha). This is something if
at all you want to achieve you could use a combination of Queue and Topic.

I hope this helps.

-Yogesh

On 11/16/05, Peter Gelderbloem <[hidden email]> wrote:

>
>
> Hi,
>
> First off, thanks for such an amazingly simple to use, yet powerful
> tool.
>
> I have a situation where I have a Topic with multiple instances of a
> subscriber. How do I make sure that message A only gets "consumed" once
> by only one instance of the subscriber group?
> Basically
> 1)message A goes into topic.
> 2)message B goes into topic
> 3)subscriber 4 from group alpha "consumes" message A in a way that no
> other subscriber from group alpha can ever "consume" message A again.
> 4)subscriber 2 from group alpha "consumes" message B in a way that no
> other subscriber from group alpha can ever "consume" message B again.
> After this sequence, Message A and B should still be available to
> subscribers not in group alpha.
>
> Thanks in advance,
> Peter Gelderbloem
>
>
Reply | Threaded
Open this post in threaded view
|

RE: [activemq-user] Multiple similar subscribers

Litton, Tom - CEPM
In reply to this post by Peter Gelderbloem
I have the same question, but i'll ask it in a different way.

We are beginning to develop a event system, with a topic as the central piece.  So, several applications publish events to the topic.  Any other system that needs to know about any event can subscribe to the topic (using selectors, or other ways of filtering events) and handle them as needed.

There is a scaling problem with this architecture however.  What happens when the publishers publish too many events for the subscribers to handle?  For example, what if an application publishes an event every second, but it takes the subscriber 1 minute to handle the event?  According to the documentation active mq will attempt to slow down the producers, but that will just cause the applications to either backlog events themselves, or slow down.  

I guess a simple way of asking the question is this:  What is the best way to make topics scalable?  Is it possible to "group" subscribers together into one logical subscriber to allow parallel processing of messages? (I believe this is what Peter is asking below).  

Should i change the way the subscribers works, so instead of handling the event directly they publish it to a queue instead?  Is there another way i'm not thinking of?

I tried briefly to google for a solution, but came up empty.  If anyone knows of a good article on this subject, please let me know.

Thanks,

Tom

-----Original Message-----
From: Peter Gelderbloem [mailto:[hidden email]]
Sent: Wednesday, November 16, 2005 4:12 AM
To: [hidden email]
Subject: [activemq-user] Multiple similar subscribers



Hi,

First off, thanks for such an amazingly simple to use, yet powerful
tool.

I have a situation where I have a Topic with multiple instances of a
subscriber. How do I make sure that message A only gets "consumed" once
by only one instance of the subscriber group?
Basically
1)message A goes into topic.
2)message B goes into topic
3)subscriber 4 from group alpha "consumes" message A in a way that no
other subscriber from group alpha can ever "consume" message A again.
4)subscriber 2 from group alpha "consumes" message B in a way that no
other subscriber from group alpha can ever "consume" message B again.
After this sequence, Message A and B should still be available to
subscribers not in group alpha.

Thanks in advance,
Peter Gelderbloem



----------------------------------------------------------------------
The information contained in this transmission is intended only for
the personal and confidential use of the designated recipients named
herein.  If the reader of this transmission is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
transmission in error, and that any review, dissemination,
distribution, or copying of this transmission is strictly prohibited.
If you have received this communication in error, please notify the
sender and return and delete the original transmission immediately.
Thank you.

Reply | Threaded
Open this post in threaded view
|

RE: [activemq-user] Multiple similar subscribers

Peter Gelderbloem
In reply to this post by Peter Gelderbloem

The topic is also used by other parts of the system, so consuming the
message would make the message unavailable to other parts. I have
decided to add a step that subscribes to the topic and publishes the
message to a q which my group of consumers would pull messages off.
Peter

-----Original Message-----
From: Yogesh Prajapati [mailto:[hidden email]]
Sent: 18 November 2005 19:48
To: [hidden email]
Subject: Re: [activemq-user] Multiple similar subscribers

To me it looks like you are trying to follow p2p model using "Topic". In
my
opinion you should be using "Queue" as destination instead and have all
your
JMS client (receivers) act as message consumer of the "Queue" (not a
subscriber to the "Topic"). This assures that one message is consumed
only
and only once by one consumer. Further, you could use a separate
"Message
Selector" (a sql query like string) for each group of consumer.

At the end, I did not understand your need of ensuring the availiability
of
the messages to the "subscribers" after they consumed by one particular
group of consumers (in your case the group is Alpha). This is something
if
at all you want to achieve you could use a combination of Queue and
Topic.

I hope this helps.

-Yogesh

On 11/16/05, Peter Gelderbloem <[hidden email]>
wrote:
>
>
> Hi,
>
> First off, thanks for such an amazingly simple to use, yet powerful
> tool.
>
> I have a situation where I have a Topic with multiple instances of a
> subscriber. How do I make sure that message A only gets "consumed"
once

> by only one instance of the subscriber group?
> Basically
> 1)message A goes into topic.
> 2)message B goes into topic
> 3)subscriber 4 from group alpha "consumes" message A in a way that no
> other subscriber from group alpha can ever "consume" message A again.
> 4)subscriber 2 from group alpha "consumes" message B in a way that no
> other subscriber from group alpha can ever "consume" message B again.
> After this sequence, Message A and B should still be available to
> subscribers not in group alpha.
>
> Thanks in advance,
> Peter Gelderbloem
>
>