@ComponentProfile(summary="Connect to a JMS 1.1 broker", tag="connections,jms") public class JmsConnection extends AllowsRetriesConnection implements JmsConnectionConfig, ConnectionComparator<JmsConnection>
In the adapter configuration file this class is aliased as jms-connection which is the preferred alternative to the fully qualified classname when building your configuration.
In the adapter configuration file this class is aliased as jms-connection which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Field and Description |
---|---|
protected javax.jms.Connection |
connection |
log
Constructor and Description |
---|
JmsConnection()
Create a new instance.
|
JmsConnection(VendorImplementation impl) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
additionalDebug() |
JmsConnection |
cloneForTesting()
Make a copy of this object for test purposes.
|
protected void |
closeConnection()
Close the underlying connection.
|
java.lang.String |
configuredClientId()
The client id.
|
java.lang.String |
configuredPassword()
The password.
|
java.lang.String |
configuredUserName()
The username.
|
VendorImplementation |
configuredVendorImplementation()
The vendor specific implementation.
|
boolean |
connectionEquals(JmsConnection connection) |
ConnectionErrorHandler |
connectionErrorHandler()
Returns the currently active
ConnectionErrorHandler |
protected void |
createConnection(javax.jms.ConnectionFactory factory) |
javax.jms.Session |
createSession(boolean transacted,
int acknowledgeMode)
Creates a new
Session on the underlying JMS Connection . |
javax.jms.Connection |
currentConnection() |
java.lang.Boolean |
getAdditionalDebug() |
java.lang.String |
getClientId()
Sets the broker connection client ID.
|
java.lang.String |
getPassword()
Sets the broker password.
|
java.lang.String |
getUserName()
Returns the broker user name.
|
VendorImplementation |
getVendorImplementation()
Sets the
VendorImplementation to use. |
protected void |
initConnection()
Initialise the underlying connection.
|
javax.jms.ConnectionFactory |
obtainConnectionFactory() |
protected void |
prepareConnection() |
void |
setAdditionalDebug(java.lang.Boolean b)
Whether or not to generate additional TRACE level debug when attempting connections.
|
void |
setClientId(java.lang.String s)
Returns the broker connection client ID.
|
void |
setPassword(java.lang.String s)
Sets the broker password.
|
void |
setUserName(java.lang.String s)
Sets the broker user name.
|
void |
setVendorImplementation(VendorImplementation imp)
Returns the
VendorImplementation to use. |
protected void |
startConnection()
Start the underlying connection.
|
protected void |
stopConnection()
Stop the underlying connection.
|
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, close, getConnectionErrorHandler, getLookupName, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setLookupName, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
public JmsConnection()
Create a new instance. Default settings are:
public JmsConnection(VendorImplementation impl)
protected void initConnection() throws CoreException
AdaptrisConnectionImp
initConnection
in class AdaptrisConnectionImp
CoreException
- wrapping any exception.AdaptrisConnectionImp.initConnection()
public javax.jms.Connection currentConnection()
public ConnectionErrorHandler connectionErrorHandler()
AdaptrisConnection
ConnectionErrorHandler
connectionErrorHandler
in interface AdaptrisConnection
connectionErrorHandler
in class AdaptrisConnectionImp
ConnectionErrorHandler
, which may not be the same as the configured...protected void startConnection() throws CoreException
AdaptrisConnectionImp
startConnection
in class AdaptrisConnectionImp
CoreException
- wrapping any exception.AdaptrisConnectionImp.startConnection()
protected void stopConnection()
AdaptrisConnectionImp
stopConnection
in class AdaptrisConnectionImp
AdaptrisConnectionImp.stopConnection()
protected void closeConnection()
AdaptrisConnectionImp
closeConnection
in class AdaptrisConnectionImp
AdaptrisConnectionImp.closeConnection()
public javax.jms.Session createSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSException
Creates a new Session
on the underlying JMS Connection
.
transacted
- true if transactedacknowledgeMode
- acknowledge modeSession
javax.jms.JMSException
- if any occurspublic javax.jms.ConnectionFactory obtainConnectionFactory() throws java.lang.Exception
java.lang.Exception
protected void createConnection(javax.jms.ConnectionFactory factory) throws java.lang.Exception
java.lang.Exception
protected void prepareConnection() throws CoreException
prepareConnection
in class AdaptrisConnectionImp
CoreException
public boolean connectionEquals(JmsConnection connection)
connectionEquals
in interface ConnectionComparator<JmsConnection>
public java.lang.String getUserName()
Returns the broker user name.
public void setUserName(java.lang.String s)
Sets the broker user name.
s
- the broker user namepublic java.lang.String getPassword()
Sets the broker password.
public void setPassword(java.lang.String s)
Sets the broker password.
In additional to plain text passwords, the passwords can also be encoded using the appropriate Password
s
- the broker passwordpublic java.lang.String getClientId()
Sets the broker connection client ID.
public void setClientId(java.lang.String s)
Returns the broker connection client ID.
s
- the broker connection client IDpublic VendorImplementation getVendorImplementation()
Sets the VendorImplementation
to use.
VendorImplementation
to usepublic void setVendorImplementation(VendorImplementation imp)
Returns the VendorImplementation
to use.
imp
- the VendorImplementation
to usepublic java.lang.Boolean getAdditionalDebug()
public void setAdditionalDebug(java.lang.Boolean b)
b
- true to enable additional logging; default false.protected boolean additionalDebug()
public java.lang.String configuredClientId()
JmsConnectionConfig
configuredClientId
in interface JmsConnectionConfig
public java.lang.String configuredPassword()
JmsConnectionConfig
configuredPassword
in interface JmsConnectionConfig
public java.lang.String configuredUserName()
JmsConnectionConfig
configuredUserName
in interface JmsConnectionConfig
public VendorImplementation configuredVendorImplementation()
JmsConnectionConfig
configuredVendorImplementation
in interface JmsConnectionConfig
public JmsConnection cloneForTesting() throws CoreException
AdaptrisConnection
cloneForTesting
in interface AdaptrisConnection
cloneForTesting
in class AdaptrisConnectionImp
CoreException
- wrapping any exceptions