Package org.apache.activemq.tool
Class AbstractJmsClient
- java.lang.Object
-
- org.apache.activemq.tool.AbstractJmsClient
-
- Direct Known Subclasses:
AbstractJmsMeasurableClient
public abstract class AbstractJmsClient extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected String
clientName
protected int
destCount
static String
DESTINATION_SEPARATOR
protected int
destIndex
protected ConnectionFactory
factory
protected Connection
jmsConnection
protected Session
jmsSession
-
Constructor Summary
Constructors Constructor Description AbstractJmsClient(ConnectionFactory factory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
commitTxIfNecessary()
Helper method that checks if session is transacted and whether to commit the tx based on commitAfterXMsgs property.protected Destination
createCompositeDestination(byte destinationType, String destName, int destCount)
protected Destination
createCompositeDestination(String destName, int destCount)
protected Destination
createDestination(String destName)
Destination[]
createDestinations(int destCount)
protected Destination
createTemporaryDestination(String destName)
abstract JmsClientProperties
getClient()
String
getClientName()
Connection
getConnection()
int
getDestCount()
protected byte
getDestinationType(String destName)
int
getDestIndex()
ConnectionFactory
getFactory()
Session
getSession()
protected String
getSimpleName(String destName)
abstract void
setClient(JmsClientProperties client)
void
setClientName(String clientName)
void
setDestCount(int destCount)
void
setDestIndex(int destIndex)
void
setFactory(ConnectionFactory factory)
-
-
-
Field Detail
-
DESTINATION_SEPARATOR
public static final String DESTINATION_SEPARATOR
- See Also:
- Constant Field Values
-
factory
protected ConnectionFactory factory
-
jmsConnection
protected Connection jmsConnection
-
jmsSession
protected Session jmsSession
-
destCount
protected int destCount
-
destIndex
protected int destIndex
-
clientName
protected String clientName
-
-
Constructor Detail
-
AbstractJmsClient
public AbstractJmsClient(ConnectionFactory factory)
-
-
Method Detail
-
getClient
public abstract JmsClientProperties getClient()
-
setClient
public abstract void setClient(JmsClientProperties client)
-
getFactory
public ConnectionFactory getFactory()
-
setFactory
public void setFactory(ConnectionFactory factory)
-
getDestCount
public int getDestCount()
-
setDestCount
public void setDestCount(int destCount)
-
getDestIndex
public int getDestIndex()
-
setDestIndex
public void setDestIndex(int destIndex)
-
getClientName
public String getClientName()
-
setClientName
public void setClientName(String clientName)
-
getConnection
public Connection getConnection() throws JMSException
- Throws:
JMSException
-
getSession
public Session getSession() throws JMSException
- Throws:
JMSException
-
createDestinations
public Destination[] createDestinations(int destCount) throws JMSException
- Throws:
JMSException
-
createCompositeDestination
protected Destination createCompositeDestination(String destName, int destCount) throws JMSException
- Throws:
JMSException
-
createCompositeDestination
protected Destination createCompositeDestination(byte destinationType, String destName, int destCount) throws JMSException
- Throws:
JMSException
-
getDestinationType
protected byte getDestinationType(String destName)
-
createDestination
protected Destination createDestination(String destName) throws JMSException
- Throws:
JMSException
-
createTemporaryDestination
protected Destination createTemporaryDestination(String destName) throws JMSException
- Throws:
JMSException
-
commitTxIfNecessary
public boolean commitTxIfNecessary() throws JMSException
Helper method that checks if session is transacted and whether to commit the tx based on commitAfterXMsgs property.- Returns:
- true if transaction was committed.
- Throws:
JMSException
- in case the call to JMS Session.commit() fails.
-
-