org.objectweb.joram.mom.dest.amqp
Class AmqpConnectionHandler

java.lang.Object
  extended by org.objectweb.joram.mom.dest.amqp.AmqpConnectionHandler
All Implemented Interfaces:
AmqpConnectionHandlerMBean

public class AmqpConnectionHandler
extends java.lang.Object
implements AmqpConnectionHandlerMBean

The AmqpConnectionHandler service handles the list of known AMQP servers, in order to keep live connections with them.


Method Summary
 void addServer(com.rabbitmq.client.ConnectionFactory factory)
          Adds an AMQP server and starts a live connection with it, accessible via the ConnectionFactory provided.
 void addServer(java.lang.String host, int port)
          Adds an AMQP server and starts a live connection with it, accessible via the ConnectionFactory provided.
 void addServer(java.lang.String host, int port, java.lang.String user, java.lang.String pass)
          Adds an AMQP server and starts a live connection with it, accessible via the ConnectionFactory provided.
 void deleteServer(java.lang.String host, int port)
          Removes the live connection to the specified AMQP server.
static java.util.List<com.rabbitmq.client.Connection> getConnections()
          Gets the list of currently opened connections.
static AmqpConnectionHandler getInstance()
           
static void init(java.lang.String args, boolean firstTime)
          Initializes the service.
static void stopService()
          Stops all connections to AMQP servers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AmqpConnectionHandler getInstance()

init

public static void init(java.lang.String args,
                        boolean firstTime)
                 throws java.lang.Exception
Initializes the service. Starts a connection with one server.

Throws:
java.lang.Exception

addServer

public void addServer(com.rabbitmq.client.ConnectionFactory factory)
Adds an AMQP server and starts a live connection with it, accessible via the ConnectionFactory provided. A server is uniquely identified with its host and port. Adding an existing server won't do anything.

Specified by:
addServer in interface AmqpConnectionHandlerMBean
Parameters:
factory - the factory used to access the server, configured properly (host, port, login, password...)

addServer

public void addServer(java.lang.String host,
                      int port)
Adds an AMQP server and starts a live connection with it, accessible via the ConnectionFactory provided. A server is uniquely identified with its host and port. Adding an existing server won't do anything.

Specified by:
addServer in interface AmqpConnectionHandlerMBean
Parameters:
host - host of the added server
port - port of the added server

addServer

public void addServer(java.lang.String host,
                      int port,
                      java.lang.String user,
                      java.lang.String pass)
Adds an AMQP server and starts a live connection with it, accessible via the ConnectionFactory provided. A server is uniquely identified with its host and port. Adding an existing server won't do anything.

Specified by:
addServer in interface AmqpConnectionHandlerMBean
Parameters:
host - host of the added server
port - port of the added server
user - user name
pass - user password

deleteServer

public void deleteServer(java.lang.String host,
                         int port)
Removes the live connection to the specified AMQP server.

Specified by:
deleteServer in interface AmqpConnectionHandlerMBean
Parameters:
host - host of the removed server
port - port of the removed server

stopService

public static void stopService()
Stops all connections to AMQP servers.


getConnections

public static java.util.List<com.rabbitmq.client.Connection> getConnections()
Gets the list of currently opened connections.

Returns:
the list of usable connections.


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.