activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dantelope <dantel...@gmail.com>
Subject VirtualTopic - Confused
Date Fri, 07 Sep 2007 15:53:18 GMT

I've been trying to get Virtual Topics to work in AMQ 4.1.1 and failing
miserably :super:

What I *want* to do is:

1) Set up a virtual topic (is this done in configuration? dynamically? i'd
prefer configuration, but...)
2) Post a message to the virtual topic (see below)
3) Receive that message from the virtual topic with a Camel consumer (see
below).

I started initially by creating a topic -- I was confused (and still am)
about what it should be named.  I'm using roughly the original activemq.xml
file, and from what I can gather, this is what I'd name it:

    <destinations>
        <topic physicalName="VirtualTopic.test" />
    </destinations>

(I also tried just "test")


Next I created a producer (in Java, via Camel) to put something on the
topic:

        CamelContext context = new DefaultCamelContext();
        context.addComponent("activemq", 
                            
ActiveMQComponent.activeMQComponent("tcp://my.amq.server:61616"));

        CamelTemplate<JmsExchange> template = new
CamelTemplate<JmsExchange>(context);
        template.sendBody( "activemq:topic:VirtualTopic.test", "Virtual
Topic Test" );


Finally, I created a consumer (again, in Java, via Camel) to pull it off:

        CamelContext context = new DefaultCamelContext();       
        context.addComponent("activemq", 
                            
ActiveMQComponent.activeMQComponent("tcp://my.amq.server:61616"));
            context.addRoutes( new RouteBuilder() {
                 public void configure() throws Exception
                {                                      
                   
from("activemq:topic:Consumer.CamelTest.VirtualTopic.test").process(new
Processor() {

                        public void process(Exchange e) {
                            System.out.println("Received Virtual Topic
exchange: " + e.getIn());                            
                        }
                    });

I've also tried banging my head against the wall, but that just hurts...
your help greatly appreciated!

-- 
View this message in context: http://www.nabble.com/VirtualTopic---Confused-tf4402062s2354.html#a12558013
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message