Hi all,
I'm very new to qpid, and basically just trying to test publishing 2000
messages and consuming messages in a queue.
Using JMX console, I see that 2000 messages are in the queue, however my
consumer is always just recieving 1000 of them.
My consumer code:
Connection connection = null;
MessageConsumer consumer = null;
try {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
properties.put("connectionfactory.local",
"amqp://guest:gu...@clientid/test?brokerlist='localhost'");
// Create the initial context
Context _ctx = new InitialContext(properties);
ConnectionFactory connectionFactory =
(ConnectionFactory) _ctx
.lookup("local");
connection = connectionFactory.createConnection();
connection.setExceptionListener(this);
connection.start();
Session session =
(Session)connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
Destination destination =
session.createQueue(_queueName);
consumer = session.createConsumer(destination);
Message msg;
while (running) {
msg = consumer.receive(2000);
onMessage(msg);
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
consumer.close();
connection.stop();
connection.close();
}
I wonder what is wrong with the queue setup or my consumer code?
Also I wonder how to delete message in the queue once it's delivered to
the client?
Thanks,
Tim
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]