I think you might have hit a real common gotcha...
http://activemq.apache.org/i-am-not-receiving-any-messages-what-is-wrong.html


On 11/02/2008, David Siefert <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to use ActiveMQ to do 'quick & easy' unit testing for JMS
> message listeners.  So far, no luck.  I've tried to reduce my problem as
> small as possible to pinpoint the problem.  Here is the code:
> public class SimpleActiveMQTest {
>
> private ConnectionFactory factory;
>
> private Destination channel = new ActiveMQTopic("t.test.a");
>
> @Before
>
> public void setUp() throws Exception {
>
> factory = new
> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
>
> }
>
> @Test
>
> public void testDestinationToDestination() throws Exception {
>
> Connection connection = factory.createConnection();
>
> Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>
> MessageProducer producer = session.createProducer(channel);
>
> TextMessage message = session.createTextMessage("TEST");
>
> producer.send(message);
>
> MessageConsumer consumer = session.createConsumer(channel);
>
> TextMessage message2 = (TextMessage) consumer.receive(30 * 1000);
>
> Assert.assertNotNull(message2);
>
> Assert.assertEquals("TEST", message2.getText());
>
> }
>
> }
>
> I've tried quite a few variations including opening separate connections
> (one to produce to the channel, the other to consume from the channel).
> I've also tried creating the topic prior to producing/consuming--just to
> verify whether or not ActiveMQ creates the channels on the fly.
>
> Help?
>
> Thanks,
>
> David
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to