Why not use nondurable subscription?
Seems it's a nondurable subscription usecase.




At 2013-10-16 20:59:03,"Matt Pavlovich" <mattr...@gmail.com> wrote:
>A couple things to look into--
>
>1. Set a message expiration. You'll set this when producing the message. 
>2. gcInactiveDestinations  (this will garbage collect a destination if a 
>consumer hasn't come around for X period of time)
>
>http://activemq.apache.org/delete-inactive-destinations.html
> 
>Hope this helps!
>
>On Oct 10, 2013, at 9:51 PM, HellKnight <hellkni...@foxmail.com> wrote:
>
>> I am using virtual topics but I've encountered a problem and I could not come
>> up with a perfect solution , so I decide to post it and I believe you guys
>> could help me .
>> 
>> My use case is something like this :
>>   a producer is monitoring a database.Once the database is updated, the
>> producer will send a message to anyone who is concerned about data updating
>> in that database, which means every message could be sent to one or more
>> consumers.However, don't assume that different messages will be sent to same
>> consumer groups.
>>    I am using virtual topics ,so the producer just sends message to a topic
>> called "VirtualTopic.AlertTopic". And as I have mentioned , there are
>> multiple users in my system just like ActiveMQ forum. Every user could run a
>> client program and login to the system , and the client program includes a
>> consumer to receive messages.  Messages sent to the virtual topic will be
>> dispatched to every queue, which means every message is actually sent to
>> every consumer, I have to use a message selector in the consumer side to
>> filter messages.
>>   I have created a queue named as "Consumer.UserID.VirtualTopic.AlertTopic"
>> for every system user. However, users will be add and removed dynamicly ,
>> and I should create a queue when adding a user and removing that queue when
>> removing the user from my system. If add a queue to ActiveMQ broker failed
>> due to exceptions, network failures etc.Then the user himself will find that
>> no message is received and he will just tell me ,so that is not a serious
>> problem.  
>>     However, if removing the user queue from activemq broker failed , there
>> will be some trouble. The user queue still exists, and since every message
>> sent to a virtual topic will be copied to every consumer queue , messages
>> will accumulating in the  queue that should be removed because the system
>> user who will consume that queue is removed from system managing database
>> and will never login again.  
>>     I've come up with two solutions:
>> 1. Delete any user queue that has no active consumer for a long time , say ,
>> 3 months. But this is imperfect, because it's possible that system user
>> would not login for months in our system , we consider that a normal
>> behaviour.
>> 
>> 2. Purge a queue when it reach storage limits. This is good ,after all the
>> user won't like too many messages appear on his screen after a long offline
>> time.However, some users may hate this behaviour , they don't wonna miss any
>> notification messages
>> 
>>   I think there is an ideal way to deal with my problem. The message should
>> only be dispatched to the queues of its receivers, not all the queues. Is it
>> possible to do that?
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://activemq.2283324.n4.nabble.com/Is-it-possible-to-dispatch-a-message-in-the-topic-to-only-a-certain-queues-while-using-virtual-topic-tp4672622.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to