activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shyam Santhanam <>
Subject Cannot receive from Virtual Topic's consumer queue
Date Wed, 28 Oct 2009 12:40:37 GMT


I'm trying to use Virtual Topics for the first time (and I'm relatively new
to ActiveMQ). I've tried to follow the instructions on the virtual
destinations page and also looked at VirtualTopicPubSubTest in activemq-core
unit tests and tried to follow it as closely as I could see.  This is the
test I have:

        TopicConnection connection = createTopicConnection();

        TopicSession session = connection.createTopicSession(false,
        Topic topic = session.createTopic("VirtualTopic.TestTopic");

        MessageListener listener = new MessageListener() {
            public void onMessage(Message msg) {
                try {
          "Message received: {0}",
                } catch (JMSException e) {
                    log.error(e, "Error receiving message");


        QueueConnection queueConnection = createQueueConnection();
        QueueSession qSession = queueConnection.createQueueSession(false,

        Queue queue = new
        MessageConsumer consumer = qSession.createConsumer(queue);

        TopicPublisher publisher = session.createPublisher(topic);
        Message message = session.createMessage();

This doesn't seem to work though.  The message is never received.  We are
using activemq-core  Am I missing something as far as the
setup goes?

Note that createTopicConnection() and createQueueConnection() do nothing
special to the connection as far as setup goes, they are straight from an
ActiveMQConnectionFactory which is setup as follows:

<bean class="org.apache.activemq.ActiveMQConnectionFactory">
    <constructor-arg value="vm://localhost"/>

(This is just one for unit-test purposes, our actual broker configuration
has more settings).

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message