Class FailoverJmsConnection
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,ConnectionComparator<JmsConnection>,JmsConnectionConfig,StateManagedComponent
This class is designed for use with JMS Brokers that do not provide any transparent failover facility. For instance, SonicMQ provides transparent failover, so you should use that instead rather than having another concrete JMSConnection instance.
Note the while this JmsConnection implementation still exposes connection configuration, these will be ignored, as all connection based activity is delegated to the underlying JmsConnections. The only configuration that overrides the underlying JmsConnection configuration is the connection-attempts and connection-wait.
In the adapter configuration file this class is aliased as failover-jms-connection which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
Fields inherited from class com.adaptris.core.jms.JmsConnection
connectionFields inherited from class com.adaptris.core.AdaptrisConnectionImp
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidClose the underlying connection.The client id.The password.The username.The vendor specific implementation.booleanconnectionEquals(JmsConnection connection) protected voidcreateConnection(javax.jms.ConnectionFactory factory) javax.jms.SessioncreateSession(boolean transacted, int acknowledgeMode) Creates a newSessionon the underlying JMSConnection.javax.jms.Connectionprotected voidInitialise the underlying connection.javax.jms.ConnectionFactoryprotected voidvoidvoidSpecify whether to register this instance or its owner with the underlying connectionprotected voidStart the underlying connection.protected voidStop the underlying connection.Methods inherited from class com.adaptris.core.jms.JmsConnection
additionalDebug, brokerDetailsForLogging, cloneForTesting, connectionErrorHandler, connectionStateHandler, getAdditionalDebug, getClientId, getPassword, getUserName, getVendorImplementation, setAdditionalDebug, setClientId, setPassword, setUserName, setVendorImplementationMethods 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, getConnectionStateHandler, getRuntimeComponent, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setConnectionStateHandler, setRuntimeComponent, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
Constructor Details
-
FailoverJmsConnection
public FailoverJmsConnection()
-
-
Method Details
-
initConnection
Description copied from class:AdaptrisConnectionImpInitialise the underlying connection.- Overrides:
initConnectionin classJmsConnection- Throws:
CoreException- wrapping any exception.- See Also:
-
startConnection
Description copied from class:AdaptrisConnectionImpStart the underlying connection.- Overrides:
startConnectionin classJmsConnection- Throws:
CoreException- wrapping any exception.- See Also:
-
stopConnection
protected void stopConnection()Description copied from class:AdaptrisConnectionImpStop the underlying connection.- Overrides:
stopConnectionin classJmsConnection- See Also:
-
closeConnection
public void closeConnection()Description copied from class:AdaptrisConnectionImpClose the underlying connection.- Overrides:
closeConnectionin classJmsConnection- See Also:
-
createSession
public javax.jms.Session createSession(boolean transacted, int acknowledgeMode) throws javax.jms.JMSException Creates a new
Sessionon the underlying JMSConnection.- Overrides:
createSessionin classJmsConnection- Parameters:
transacted- true if transactedacknowledgeMode- acknowledge mode- Returns:
- a new
Session - Throws:
javax.jms.JMSException- if any occurs
-
createConnection
- Overrides:
createConnectionin classJmsConnection- Throws:
Exception
-
getConnections
-
addConnection
-
setConnections
-
getRegisterOwner
- Returns:
- the registerOwner
- See Also:
-
setRegisterOwner
Specify whether to register this instance or its owner with the underlying connection- Parameters:
b- the registerOwner to set, defaults to false which registers this instance as the owner of the underlying connection.
-
prepareConnection
- Overrides:
prepareConnectionin classJmsConnection- Throws:
CoreException
-
obtainConnectionFactory
- Overrides:
obtainConnectionFactoryin classJmsConnection- Throws:
Exception
-
currentConnection
public javax.jms.Connection currentConnection()- Overrides:
currentConnectionin classJmsConnection
-
configuredClientId
Description copied from interface:JmsConnectionConfigThe client id.- Specified by:
configuredClientIdin interfaceJmsConnectionConfig- Overrides:
configuredClientIdin classJmsConnection- Returns:
- the client id
-
configuredPassword
Description copied from interface:JmsConnectionConfigThe password.- Specified by:
configuredPasswordin interfaceJmsConnectionConfig- Overrides:
configuredPasswordin classJmsConnection- Returns:
- the password
-
configuredUserName
Description copied from interface:JmsConnectionConfigThe username.- Specified by:
configuredUserNamein interfaceJmsConnectionConfig- Overrides:
configuredUserNamein classJmsConnection- Returns:
- the username
-
configuredVendorImplementation
Description copied from interface:JmsConnectionConfigThe vendor specific implementation.- Specified by:
configuredVendorImplementationin interfaceJmsConnectionConfig- Overrides:
configuredVendorImplementationin classJmsConnection- Returns:
- the vendor specific implementation
-
connectionEquals
- Specified by:
connectionEqualsin interfaceConnectionComparator<JmsConnection>- Overrides:
connectionEqualsin classJmsConnection
-