Class JmsConnection
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,ConnectionComparator<JmsConnection>,JmsConnectionConfig,StateManagedComponent
- Direct Known Subclasses:
FailoverJmsConnection
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.
-
Field Summary
FieldsFields inherited from class com.adaptris.core.AdaptrisConnectionImp
log -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanMake a copy of this object for test purposes.protected voidClose the underlying connection.The client id.The password.The username.The vendor specific implementation.booleanconnectionEquals(JmsConnection connection) Returns the currently activeConnectionErrorHandlerprotected voidcreateConnection(javax.jms.ConnectionFactory factory) javax.jms.SessioncreateSession(boolean transacted, int acknowledgeMode) Creates a newSessionon the underlying JMSConnection.javax.jms.ConnectionSets the broker connection client ID.Sets the broker password.Returns the broker user name.Sets theVendorImplementationto use.protected voidInitialise the underlying connection.javax.jms.ConnectionFactoryprotected voidvoidWhether or not to generate additional TRACE level debug when attempting connections.voidReturns the broker connection client ID.voidSets the broker password.voidSets the broker user name.voidReturns theVendorImplementationto use.protected voidStart the underlying connection.protected voidStop the underlying connection.Methods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryIntervalMethods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, close, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
Field Details
-
connection
protected transient javax.jms.Connection connection
-
-
Constructor Details
-
JmsConnection
public JmsConnection()Create a new instance. Default settings are:
- vendor-implementation - StandardJndiImplementation
- username - "" (i.e. blank)
-
JmsConnection
-
-
Method Details
-
initConnection
Description copied from class:AdaptrisConnectionImpInitialise the underlying connection.- Specified by:
initConnectionin classAdaptrisConnectionImp- Throws:
CoreException- wrapping any exception.- See Also:
-
currentConnection
public javax.jms.Connection currentConnection() -
connectionErrorHandler
Description copied from interface:AdaptrisConnectionReturns the currently activeConnectionErrorHandler- Specified by:
connectionErrorHandlerin interfaceAdaptrisConnection- Overrides:
connectionErrorHandlerin classAdaptrisConnectionImp- Returns:
- the active
ConnectionErrorHandler, which may not be the same as the configured...
-
startConnection
Description copied from class:AdaptrisConnectionImpStart the underlying connection.- Specified by:
startConnectionin classAdaptrisConnectionImp- Throws:
CoreException- wrapping any exception.- See Also:
-
stopConnection
protected void stopConnection()Description copied from class:AdaptrisConnectionImpStop the underlying connection.- Specified by:
stopConnectionin classAdaptrisConnectionImp- See Also:
-
closeConnection
protected void closeConnection()Description copied from class:AdaptrisConnectionImpClose the underlying connection.- Specified by:
closeConnectionin classAdaptrisConnectionImp- See Also:
-
createSession
public javax.jms.Session createSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSException Creates a new
Sessionon the underlying JMSConnection.- Parameters:
transacted- true if transactedacknowledgeMode- acknowledge mode- Returns:
- a new
Session - Throws:
javax.jms.JMSException- if any occurs
-
obtainConnectionFactory
- Throws:
Exception
-
brokerDetailsForLogging
-
createConnection
- Throws:
Exception
-
prepareConnection
- Specified by:
prepareConnectionin classAdaptrisConnectionImp- Throws:
CoreException
-
connectionEquals
- Specified by:
connectionEqualsin interfaceConnectionComparator<JmsConnection>
-
getUserName
Returns the broker user name.
- Returns:
- the broker user name
-
setUserName
Sets the broker user name.
- Parameters:
s- the broker user name
-
getPassword
Sets the broker password.
- Returns:
- the broker password
-
setPassword
Sets the broker password.
In additional to plain text passwords, the passwords can also be encoded using the appropriate
Password- Parameters:
s- the broker password
-
getClientId
Sets the broker connection client ID.
- Returns:
- the broker connection client ID
-
setClientId
Returns the broker connection client ID.
- Parameters:
s- the broker connection client ID
-
getVendorImplementation
Sets the
VendorImplementationto use.- Returns:
- the
VendorImplementationto use
-
setVendorImplementation
Returns the
VendorImplementationto use.- Parameters:
imp- theVendorImplementationto use
-
getAdditionalDebug
-
setAdditionalDebug
Whether or not to generate additional TRACE level debug when attempting connections.- Parameters:
b- true to enable additional logging; default false.
-
additionalDebug
protected boolean additionalDebug() -
configuredClientId
Description copied from interface:JmsConnectionConfigThe client id.- Specified by:
configuredClientIdin interfaceJmsConnectionConfig- Returns:
- the client id
-
configuredPassword
Description copied from interface:JmsConnectionConfigThe password.- Specified by:
configuredPasswordin interfaceJmsConnectionConfig- Returns:
- the password
-
configuredUserName
Description copied from interface:JmsConnectionConfigThe username.- Specified by:
configuredUserNamein interfaceJmsConnectionConfig- Returns:
- the username
-
configuredVendorImplementation
Description copied from interface:JmsConnectionConfigThe vendor specific implementation.- Specified by:
configuredVendorImplementationin interfaceJmsConnectionConfig- Returns:
- the vendor specific implementation
-
cloneForTesting
Description copied from interface:AdaptrisConnectionMake a copy of this object for test purposes.- Specified by:
cloneForTestingin interfaceAdaptrisConnection- Overrides:
cloneForTestingin classAdaptrisConnectionImp- Returns:
- a copy of this object
- Throws:
CoreException- wrapping any exceptions
-