use of javax.jms.ConnectionMetaData in project activemq-artemis by apache.
the class ConnectionTest method testGetMetadata.
@Test
public void testGetMetadata() throws Exception {
Connection connection = createConnection();
ConnectionMetaData metaData = connection.getMetaData();
// TODO - need to check whether these are same as current version
metaData.getJMSMajorVersion();
metaData.getJMSMinorVersion();
metaData.getJMSProviderName();
metaData.getJMSVersion();
metaData.getJMSXPropertyNames();
metaData.getProviderMajorVersion();
metaData.getProviderMinorVersion();
metaData.getProviderVersion();
connection.close();
}
use of javax.jms.ConnectionMetaData in project spring-boot by spring-projects.
the class JmsHealthIndicatorTests method jmsBrokerUsesFailover.
@Test
public void jmsBrokerUsesFailover() throws JMSException {
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class);
given(connectionMetaData.getJMSProviderName()).willReturn("JMS test provider");
Connection connection = mock(Connection.class);
given(connection.getMetaData()).willReturn(connectionMetaData);
willThrow(new JMSException("Could not start", "123")).given(connection).start();
given(connectionFactory.createConnection()).willReturn(connection);
JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory);
Health health = indicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails().get("provider")).isNull();
}
use of javax.jms.ConnectionMetaData in project iaf by ibissource.
the class JmsMessagingSourceFactory method getConnectionFactoryInfo.
public String getConnectionFactoryInfo(ConnectionFactory connectionFactory) {
if ("TIBCOAMX".equals(applicationServerType)) {
// javax.resource.ResourceException: JMSJCA-E084: Failed to create session: The JNDI name is null
return null;
}
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;
}
use of javax.jms.ConnectionMetaData in project qpid-broker-j by apache.
the class QpidRestAPIQueueCreator method getProtocolVersion.
@Override
public String getProtocolVersion(final Connection connection) {
if (connection != null) {
try {
// Qpid 0-8..0-10 method only
final Method method = connection.getClass().getMethod("getProtocolVersion");
Object version = method.invoke(connection);
return String.valueOf(version);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
try {
ConnectionMetaData metaData = connection.getMetaData();
if (metaData != null && ("QpidJMS".equals(metaData.getJMSProviderName()) || "AMQP.ORG".equals(metaData.getJMSProviderName()))) {
return "1.0";
}
} catch (JMSException e1) {
return null;
}
return null;
}
}
return null;
}
Aggregations