mirror of https://github.com/apache/activemq.git
- Added properties and display for provider name/version, jms version, and jms properties
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@416592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
75bf37eaaa
commit
127a36a02b
|
@ -17,6 +17,8 @@
|
|||
package org.apache.activemq.tool;
|
||||
|
||||
import org.apache.activemq.tool.properties.JmsClientProperties;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Connection;
|
||||
|
@ -25,6 +27,8 @@ import javax.jms.JMSException;
|
|||
import javax.jms.Destination;
|
||||
|
||||
public abstract class AbstractJmsClient {
|
||||
private static final Log log = LogFactory.getLog(AbstractJmsClient.class);
|
||||
|
||||
protected ConnectionFactory factory;
|
||||
protected Connection jmsConnection;
|
||||
protected Session jmsSession;
|
||||
|
@ -74,7 +78,16 @@ public abstract class AbstractJmsClient {
|
|||
public Connection getConnection() throws JMSException {
|
||||
if (jmsConnection == null) {
|
||||
jmsConnection = factory.createConnection();
|
||||
|
||||
getClient().setJmsProvider(jmsConnection.getMetaData().getJMSProviderName() + jmsConnection.getMetaData().getProviderVersion());
|
||||
getClient().setJmsVersion("JMS " + jmsConnection.getMetaData().getJMSVersion());
|
||||
getClient().setJmsProperties(jmsConnection.getMetaData().getJMSXPropertyNames().toString());
|
||||
}
|
||||
|
||||
log.info("Using JMS Connection:" +
|
||||
" Provider=" + getClient().getJmsProvider() +
|
||||
" JMS Spec=" + getClient().getJmsVersion() +
|
||||
" JMS Properties=" + getClient().getJmsProperties());
|
||||
return jmsConnection;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,10 @@ public class JmsClientProperties extends AbstractObjectProperties {
|
|||
protected String sessAckMode = SESSION_AUTO_ACKNOWLEDGE;
|
||||
protected boolean sessTransacted = false;
|
||||
|
||||
protected String jmsProvider = null;
|
||||
protected String jmsVersion = null;
|
||||
protected String jmsProperties = null;
|
||||
|
||||
public String getDestName() {
|
||||
return destName;
|
||||
}
|
||||
|
@ -58,4 +62,28 @@ public class JmsClientProperties extends AbstractObjectProperties {
|
|||
public void setSessTransacted(boolean sessTransacted) {
|
||||
this.sessTransacted = sessTransacted;
|
||||
}
|
||||
|
||||
public String getJmsProvider() {
|
||||
return jmsProvider;
|
||||
}
|
||||
|
||||
public void setJmsProvider(String jmsProvider) {
|
||||
this.jmsProvider = jmsProvider;
|
||||
}
|
||||
|
||||
public String getJmsVersion() {
|
||||
return jmsVersion;
|
||||
}
|
||||
|
||||
public void setJmsVersion(String jmsVersion) {
|
||||
this.jmsVersion = jmsVersion;
|
||||
}
|
||||
|
||||
public String getJmsProperties() {
|
||||
return jmsProperties;
|
||||
}
|
||||
|
||||
public void setJmsProperties(String jmsProperties) {
|
||||
this.jmsProperties = jmsProperties;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue