Adding to that, I am able to create more than one queue with a for loop around session, destination.. like bwlo code:
try { // Create a ConnectionFactory ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); // Create a Connection Connection connection = connectionFactory.createConnection(); connection.start(); for(int i = 0; i < 10; i++){ // Create a Session Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); // Create the destination (Topic or Queue) Destination destination = session.createQueue("TEST.FOO" + i); // Create a MessageProducer from the Session to the Topic or Queue MessageProducer producer = session.createProducer(destination); //producer.setDeliveryMode(DeliveryMode.PERSISTENT); // Create a messages String text = "Hello world! From: " + Thread.currentThread().getName() + " : " + this.hashCode(); TextMessage message = session.createTextMessage(text); // Tell the producer to send the message System.out.println("Sent message: "+ message.hashCode() + " : " + Thread.currentThread().getName()); producer.send(message); // Clean up session.close(); } connection.close(); } catch (Exception e) { System.out.println("Caught: " + e); e.printStackTrace(); } However I am not sure how the session for different queue will be distinguished (session and queue association). Even being a naive with activemq implementation, I am not sure (and doubt) if the above code is correct. Please help -- View this message in context: http://activemq.2283324.n4.nabble.com/How-to-setup-multiple-queues-tp3092113p4661190.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.