Example usage for javax.jms Connection getMetaData

List of usage examples for javax.jms Connection getMetaData

Introduction

In this page you can find the example usage for javax.jms Connection getMetaData.

Prototype


ConnectionMetaData getMetaData() throws JMSException;

Source Link

Document

Gets the metadata for this connection.

Usage

From source file:nl.nn.adapterframework.jms.JmsMessagingSourceFactory.java

public String getConnectionFactoryInfo(ConnectionFactory connectionFactory) {
    if (IbisContext.getApplicationServerType().equals("TIBCOAMX")) {
        // Workaround to prevent the following exception:
        // [org.apache.geronimo.connector.outbound.MCFConnectionInterceptor] - Error occurred creating ManagedConnection for org.apache.geronimo.connector.outbound.ConnectionInfo@#######
        // javax.resource.ResourceException: JMSJCA-E084: Failed to create session: The JNDI name is null
        return null;
    }/*from w ww. ja v  a 2s .c  o m*/
    String info = null;
    Connection connection = null;
    try {
        connection = connectionFactory.createConnection();
        ConnectionMetaData metaData = connection.getMetaData();
        info = "jms provider name [" + metaData.getJMSProviderName() + "] jms provider version ["
                + metaData.getProviderVersion() + "] jms version [" + metaData.getJMSVersion() + "]";
    } catch (JMSException e) {
        log.warn("Exception determining connection factory info", e);
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (JMSException e1) {
                log.warn("Exception closing connection for metadata", e1);
            }
        }
    }
    return info;
}