List of usage examples for javax.jms ConnectionMetaData getJMSXPropertyNames
Enumeration getJMSXPropertyNames() throws JMSException;
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; }