activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajpreet <rajpre...@revenuescience.com>
Subject Spring-JMS and reading messages from existing destinations in ActiveMQ
Date Fri, 17 Oct 2008 00:55:41 GMT

So I am doing this in my code  to start a consumer, I use JmsTemplate to
create connectionFactory, then create a connection, do a start , obtain a
session , then create a consumer and set the Message Listener.

So far so good, I am using Active MQ as the JMS provider, now if I use bring
up my consumer for a destination(it's a queue) that is not created in
ActiveMQ , everything works fine. My consumer picks up the messages to sent
to the destination.

But the problem happens, when a queue is already created, when I start my
consumer the consumer doesn't listen to the queue and doesn't pick up
messages. Messages stay in the pending state. Is there a config I should
change or am I doing something wrong while creating the consumer ?

----------------------------------------------------------------

template.setSessionAcknowledgeMode(Session.CLIENT_ ACKNOWLEDGE);
ConnectionFactory factory = template.getConnectionFactory();
connection = factory.createConnection();

connection.start();

session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);

consumer = session.createConsumer(destination);
consumer.setMessageListener(this);[/html] 
-- 
View this message in context: http://www.nabble.com/Spring-JMS-and-reading-messages-from-existing-destinations-in-ActiveMQ-tp20024181p20024181.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message