Example usage for javax.jms QueueSession createQueue

List of usage examples for javax.jms QueueSession createQueue

Introduction

In this page you can find the example usage for javax.jms QueueSession createQueue.

Prototype


Queue createQueue(String queueName) throws JMSException;

Source Link

Document

Creates a queue identity given a Queue name.

Usage

From source file:org.apache.synapse.transport.jms.JMSUtils.java

/**
 * Create a JMS Queue using the given connection with the JNDI destination name, and return the
 * JMS Destination name of the created queue
 *
 * @param con the JMS Connection to be used
 * @param destinationJNDIName the JNDI name of the Queue to be created
 * @return the JMS Destination name of the created Queue
 * @throws JMSException on error/*  w w  w.ja  v  a2s  .  c o  m*/
 */
public static String createJMSQueue(Connection con, String destinationJNDIName) throws JMSException {
    try {
        QueueSession session = ((QueueConnection) con).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queue = session.createQueue(destinationJNDIName);
        log.info("JMS Queue with JNDI name : " + destinationJNDIName + " created");
        return queue.getQueueName();

    } finally {
        try {
            con.close();
        } catch (JMSException ignore) {
        }
    }
}