@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.
connection
log
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, setVendorImplementation
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
protected void initConnection() throws CoreException
AdaptrisConnectionImp
initConnection
in class JmsConnection
CoreException
- wrapping any exception.AdaptrisConnectionImp.init()
protected void startConnection() throws CoreException
AdaptrisConnectionImp
startConnection
in class JmsConnection
CoreException
- wrapping any exception.JmsConnection.startConnection()
protected void stopConnection()
AdaptrisConnectionImp
stopConnection
in class JmsConnection
JmsConnection.stopConnection()
public void closeConnection()
AdaptrisConnectionImp
closeConnection
in class JmsConnection
JmsConnection.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 JmsConnection
transacted
- true if transactedacknowledgeMode
- acknowledge modeSession
javax.jms.JMSException
- if any occursprotected void createConnection(javax.jms.ConnectionFactory factory) throws java.lang.Exception
createConnection
in class JmsConnection
java.lang.Exception
public 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 JmsConnection
CoreException
public javax.jms.ConnectionFactory obtainConnectionFactory() throws java.lang.Exception
obtainConnectionFactory
in class JmsConnection
java.lang.Exception
public javax.jms.Connection currentConnection()
currentConnection
in class JmsConnection
public java.lang.String configuredClientId()
JmsConnectionConfig
configuredClientId
in interface JmsConnectionConfig
configuredClientId
in class JmsConnection
public java.lang.String configuredPassword()
JmsConnectionConfig
configuredPassword
in interface JmsConnectionConfig
configuredPassword
in class JmsConnection
public java.lang.String configuredUserName()
JmsConnectionConfig
configuredUserName
in interface JmsConnectionConfig
configuredUserName
in class JmsConnection
public VendorImplementation configuredVendorImplementation()
JmsConnectionConfig
configuredVendorImplementation
in interface JmsConnectionConfig
configuredVendorImplementation
in class JmsConnection
public boolean connectionEquals(JmsConnection connection)
connectionEquals
in interface ConnectionComparator<JmsConnection>
connectionEquals
in class JmsConnection