-
1. Re: Virtual topics in camel / activemq
garytully Jun 25, 2012 11:32 AM (in response to paul.berry)That looks correct:
A great reference for working code is always the tests.
For a simple virtual topic test see: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java?view=markup
The producer sends to: VirtualTopic.TEST
the consumer consumes from: Consumer.A.VirtualTopic.TEST
The caveat is that the consumer needs to be created before the producer so that the matching consumer queue exists when the virtual topic filter on send gets to do its work.
Is there any chance that "useVirtualTopics=false" on the broker element in xml configuration, that would disable the virtual topic feature?
-
2. Re: Virtual topics in camel / activemq
paul.berry Jun 25, 2012 11:59 AM (in response to garytully)I'll take a look at the tests now, cheers.
By saying the consumers have to be created before the publisher, does that mean that I can't dynamically add consumers at runtime?
I just tried again but making sure the consumer was created first, same result.. all messages pushed onto the virtual topic sit there, they never go to the consumer queue.
-
3. Re: Virtual topics in camel / activemq
garytully Jun 25, 2012 12:00 PM (in response to paul.berry)you can dynamically add consumers, but they won't be retrospective. They will just get messages that arrive after their subscription.
-
4. Re: Virtual topics in camel / activemq
paul.berry Jun 25, 2012 12:21 PM (in response to garytully)That's fine, I wouldn't expect to get old messages...I'd expect to get messages from when the consumer is created though!
So, just to clarify I should be able to create a queue with the id of:
VirtualTopic.mytopicname
then create consumer queues like:
Consumer.myconsumername1.VirtualTopic.mytopicname
and when a message is pushed into the VirtualTopic I should see it go to the consumer queues as well?
-
5. Re: Virtual topics in camel / activemq
garytully Jun 27, 2012 6:10 AM (in response to paul.berry)paul.berry wrote:
So, just to clarify I should be able to create a queue with the id of:
VirtualTopic.mytopicname
you should be able to create a topic with that name.
-
6. Re: Virtual topics in camel / activemq
paul.berry Jun 27, 2012 6:12 AM (in response to garytully)Yes.... that was sort of the problem. The guy who wrote the route that was pushing stuff into the topic had used 'queue' instead of 'topic'... hence all the problems I was having :/
Thanks for the help