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 StringclientNameprotected intdestCountstatic StringDESTINATION_SEPARATORprotected intdestIndexprotected ConnectionFactoryfactoryprotected ConnectionjmsConnectionprotected SessionjmsSession
-
Constructor Summary
Constructors Constructor Description AbstractJmsClient(ConnectionFactory factory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancommitTxIfNecessary()Helper method that checks if session is transacted and whether to commit the tx based on commitAfterXMsgs property.protected DestinationcreateCompositeDestination(byte destinationType, String destName, int destCount)protected DestinationcreateCompositeDestination(String destName, int destCount)protected DestinationcreateDestination(String destName)Destination[]createDestinations(int destCount)protected DestinationcreateTemporaryDestination(String destName)abstract JmsClientPropertiesgetClient()StringgetClientName()ConnectiongetConnection()intgetDestCount()protected bytegetDestinationType(String destName)intgetDestIndex()ConnectionFactorygetFactory()SessiongetSession()protected StringgetSimpleName(String destName)abstract voidsetClient(JmsClientProperties client)voidsetClientName(String clientName)voidsetDestCount(int destCount)voidsetDestIndex(int destIndex)voidsetFactory(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 JMSExceptionHelper 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.
-
-