In my client application, I create several consumers, but they can't concurrently process the queue. Always, only a single consumer processes the queue messages. I don't know why.
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.PROVIDER_URL, "192.168.1.111:1099");
InitialContext ctx = new InitialContext(env);
ConnectionFactory cf = (ConnectionFactory) ctx.lookup("/ConnectionFactory");
Queue downQueue = (Queue) ctx.lookup("queue/DownQueue");
Session consumerSession = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
MessageConsumer consumer;
for (int i = 0; i < 2; i++) {
consumer = consumerSession.createConsumer(downQueue, "proxyId=0");
consumer.setMessageListener(listener);
}
How do I process the queue with multiple concurrent consumers?