@ComponentProfile(summary="Connect to a JMS 1.1 broker supporting broker failover in a vendor independent way",
tag="connections,jms")
public class FailoverJmsConnection
extends JmsConnection
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.
connectionlog| Constructor and Description |
|---|
FailoverJmsConnection() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnection(JmsConnection c) |
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) |
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.util.List<JmsConnection> |
getConnections() |
java.lang.Boolean |
getRegisterOwner() |
protected void |
initConnection()
Initialise the underlying connection.
|
javax.jms.ConnectionFactory |
obtainConnectionFactory() |
protected void |
prepareConnection() |
void |
setConnections(java.util.List<JmsConnection> l) |
void |
setRegisterOwner(java.lang.Boolean b)
Specify whether to register this instance or its owner with the underlying
connection
|
protected void |
startConnection()
Start the underlying connection.
|
protected void |
stopConnection()
Stop the underlying connection.
|
additionalDebug, cloneForTesting, connectionErrorHandler, getAdditionalDebug, getClientId, getPassword, getUserName, getVendorImplementation, setAdditionalDebug, setClientId, setPassword, setUserName, setVendorImplementationconnectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryIntervaladdExceptionListener, 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, workersFirstOnShutdownprotected void initConnection()
throws CoreException
AdaptrisConnectionImpinitConnection in class JmsConnectionCoreException - wrapping any exception.AdaptrisConnectionImp.init()protected void startConnection()
throws CoreException
AdaptrisConnectionImpstartConnection in class JmsConnectionCoreException - wrapping any exception.JmsConnection.startConnection()protected void stopConnection()
AdaptrisConnectionImpstopConnection in class JmsConnectionJmsConnection.stopConnection()public void closeConnection()
AdaptrisConnectionImpcloseConnection in class JmsConnectionJmsConnection.closeConnection()public javax.jms.Session createSession(boolean transacted,
int acknowledgeMode)
throws javax.jms.JMSException
Creates a new Session on the underlying JMS
Connection.
createSession in class JmsConnectiontransacted - true if transactedacknowledgeMode - acknowledge modeSessionjavax.jms.JMSException - if any occursprotected void createConnection(javax.jms.ConnectionFactory factory)
throws java.lang.Exception
createConnection in class JmsConnectionjava.lang.Exceptionpublic java.util.List<JmsConnection> getConnections()
public void addConnection(JmsConnection c)
public void setConnections(java.util.List<JmsConnection> l)
public java.lang.Boolean getRegisterOwner()
setRegisterOwner(Boolean)public void setRegisterOwner(java.lang.Boolean b)
b - the registerOwner to set, defaults to false which registers this
instance as the owner of the underlying connection.protected void prepareConnection()
throws CoreException
prepareConnection in class JmsConnectionCoreExceptionpublic javax.jms.ConnectionFactory obtainConnectionFactory()
throws java.lang.Exception
obtainConnectionFactory in class JmsConnectionjava.lang.Exceptionpublic javax.jms.Connection currentConnection()
currentConnection in class JmsConnectionpublic java.lang.String configuredClientId()
JmsConnectionConfigconfiguredClientId in interface JmsConnectionConfigconfiguredClientId in class JmsConnectionpublic java.lang.String configuredPassword()
JmsConnectionConfigconfiguredPassword in interface JmsConnectionConfigconfiguredPassword in class JmsConnectionpublic java.lang.String configuredUserName()
JmsConnectionConfigconfiguredUserName in interface JmsConnectionConfigconfiguredUserName in class JmsConnectionpublic VendorImplementation configuredVendorImplementation()
JmsConnectionConfigconfiguredVendorImplementation in interface JmsConnectionConfigconfiguredVendorImplementation in class JmsConnectionpublic boolean connectionEquals(JmsConnection connection)
connectionEquals in interface ConnectionComparator<JmsConnection>connectionEquals in class JmsConnection