You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Noufal <no...@gmail.com> on 2015/05/20 10:31:48 UTC

Virtual Topic - Will work for following scenario

HI All,

I am using ActiveMQ 5.5.1. And i have  5 consumers and all these consumers
are subscribed (durable subscription) to a topic say "VirtualTopic.Test".
And i have one producer and it is sending to the created topic and it is
working fine. In some cases i dont want to send few messages to all
consumers. I want to send to a particular consumer. Can i use Virtual Topic
for this? (i tried but it is not working)


The Way Subscribers Created :
Topic topic= session.createTopic("Consumer.test1.VirtualTopic.Test");
TopicSubscriber consumer = session.createDurableSubscriber(topic,
subscriptionName);
MessageConsumer	consumer = session.createConsumer(topic);

The Way Producer Created :
Destination destination = session.createTopic("VirtualTopic.Test");
Producer producer = session.createProducer(destination);

And folllowing changes in activemq.xml

<destinationInterceptors>
      <virtualDestinationInterceptor>
        <virtualDestinations>
          <virtualTopic name=">" prefix="Consumer.*."
selectorAware="false"/>
        </virtualDestinations>
      </virtualDestinationInterceptor>
    </destinationInterceptors>


Noufal.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Virtual-Topic-Will-work-for-following-scenario-tp4696687.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Virtual Topic - Will work for following scenario

Posted by Noufal <no...@gmail.com>.
In case i want to send message to particular consumer, i have changed my
producer code to send the message to consumer's queue directly not to the
virtual topic. 

Thanks
Noufal.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Virtual-Topic-Will-work-for-following-scenario-tp4696687p4696843.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Virtual Topic - Will work for following scenario

Posted by Tim Bain <tb...@alumni.duke.edu>.
How did using a virtual topic allow your consumers to selectively receive
only some of the messages destined for them?

If you don't use durable subscriptions, you'll still consume messages as
usual.  The only difference you'd see is in the behavior if you
disconnected your consumer and reconnected it later; if you don't care what
happens then, there's nothing to worry about.

On Thu, May 21, 2015 at 2:53 AM, Noufal <no...@gmail.com> wrote:

> I am able to use virtual topic and solve the issue..
>
> In case of subscriber i have to use queue instead of Topic and use this
> queue for consumer. Suppose we should not use durable subscriptions.
>
> Noufal.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Virtual-Topic-Will-work-for-following-scenario-tp4696687p4696757.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Virtual Topic - Will work for following scenario

Posted by Noufal <no...@gmail.com>.
I am able to use virtual topic and solve the issue..

In case of subscriber i have to use queue instead of Topic and use this
queue for consumer. Suppose we should not use durable subscriptions.

Noufal.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Virtual-Topic-Will-work-for-following-scenario-tp4696687p4696757.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.