public class LiveServerConnection extends Object implements LiveServerConnectionMBean, com.rabbitmq.client.ShutdownListener, Serializable
LiveServerConnection
keeps alive a connection to an AMQP server.
When the connection fails, a reconnection routine starts.Modifier and Type | Class and Description |
---|---|
private class |
LiveServerConnection.ReconnectionDaemon
The
ReconnectionDaemon thread is responsible for reconnecting
the module with the foreign AMQP server in case of disconnection. |
Modifier and Type | Field and Description |
---|---|
private LiveServerConnection.ReconnectionDaemon |
cnxDaemon |
private com.rabbitmq.client.ConnectionFactory |
cnxFactory |
private com.rabbitmq.client.Connection |
conn |
private String |
host |
private static org.objectweb.util.monolog.api.Logger |
logger |
private String |
name |
private String |
password |
private int |
port |
private static long |
serialVersionUID |
private String |
user |
Constructor and Description |
---|
LiveServerConnection()
Starts a connection with a default AMQP server.
|
LiveServerConnection(String name,
String host,
int port,
String user,
String password)
Starts a connection with a server accessible via the factory provided.
|
Modifier and Type | Method and Description |
---|---|
com.rabbitmq.client.Connection |
getConnection() |
com.rabbitmq.client.ConnectionFactory |
getConnectionFactory() |
String |
getHost() |
private String |
getMBeanName() |
String |
getName() |
int |
getPort() |
String |
getState() |
String |
getUserName() |
boolean |
isConnectionOpen() |
void |
shutdownCompleted(com.rabbitmq.client.ShutdownSignalException cause) |
void |
startLiveConnection() |
void |
stopLiveConnection()
Stops maintaining the connection alive with the server.
|
private static final long serialVersionUID
private static final org.objectweb.util.monolog.api.Logger logger
private transient com.rabbitmq.client.ConnectionFactory cnxFactory
private transient LiveServerConnection.ReconnectionDaemon cnxDaemon
private transient volatile com.rabbitmq.client.Connection conn
private String name
private String host
private int port
private String user
private String password
public LiveServerConnection()
public void startLiveConnection()
public boolean isConnectionOpen()
public com.rabbitmq.client.Connection getConnection()
public com.rabbitmq.client.ConnectionFactory getConnectionFactory()
private String getMBeanName()
public void stopLiveConnection()
public void shutdownCompleted(com.rabbitmq.client.ShutdownSignalException cause)
shutdownCompleted
in interface com.rabbitmq.client.ShutdownListener
public String getHost()
getHost
in interface LiveServerConnectionMBean
public int getPort()
getPort
in interface LiveServerConnectionMBean
public String getName()
public String getUserName()
getUserName
in interface LiveServerConnectionMBean
public String getState()
getState
in interface LiveServerConnectionMBean
Copyright © 2021 ScalAgent D.T.. All rights reserved.