Example usage for javax.jms ConnectionMetaData getJMSXPropertyNames

List of usage examples for javax.jms ConnectionMetaData getJMSXPropertyNames

Introduction

In this page you can find the example usage for javax.jms ConnectionMetaData getJMSXPropertyNames.

Prototype


Enumeration getJMSXPropertyNames() throws JMSException;

Source Link

Document

Gets an enumeration of the JMSX property names.

Usage

From source file:org.mule.transport.jms.redelivery.AutoDiscoveryRedeliveryHandlerFactory.java

/**
 * Create an instance using the discovery mechanism.
 *
 * @return an implementation based on the results of discovery
 *//*w ww  .jav a 2 s .  c  o m*/
protected RedeliveryHandler createInstance() {
    RedeliveryHandler newInstance;
    try {
        ConnectionMetaData metaData = connector.getConnection().getMetaData();
        boolean supportsDeliveryCount = false;
        final Enumeration propNames = metaData.getJMSXPropertyNames();
        while (propNames.hasMoreElements()) {
            String p = (String) propNames.nextElement();
            if (JmsConstants.JMS_X_DELIVERY_COUNT.equals(p)) {
                supportsDeliveryCount = true;
                break;
            }
        }

        newInstance = (supportsDeliveryCount) ? new JmsXRedeliveryHandler() : new CountingRedeliveryHandler();
    } catch (JMSException e) {
        // fallback to defaults
        newInstance = new CountingRedeliveryHandler();
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Using " + newInstance.getClass().getName());
    }

    return newInstance;
}