omq.common.util

## Class OmqConnectionFactory

- java.lang.Object
- - omq.common.util.OmqConnectionFactory

-     public class OmqConnectionFactory
      extends java.lang.Object

  This class creates RabbitMQ connections
  Author:
    Sergi Toda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OmqConnectionFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static com.rabbitmq.client.Channel` | `getNewChannel()` This method creates a new channel if the singleton pattern is used
    `static com.rabbitmq.client.Connection` | `getNewConnection(java.util.Properties env)` This function creates a new rabbitmq connection using the properties set in env
    `static com.rabbitmq.client.Connection` | `getNewWorkingConnection(java.util.Properties env)` This function returns a working connection.
    `static void` | `init(java.util.Properties env)` If this class is wanted to use as a singleton class this is the init function

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OmqConnectionFactory

          public OmqConnectionFactory()

  - ### Method Detail

    - #### init

          public static void init(java.util.Properties env)
                           throws java.security.KeyManagementException,
                                  java.security.NoSuchAlgorithmException,
                                  java.io.IOException

      If this class is wanted to use as a singleton class this is the init function
      Parameters:
        `env` - - environment that sets the properties needed by RabbitMQ
      Throws:
        `java.security.KeyManagementException`
        `java.security.NoSuchAlgorithmException`
        `java.io.IOException`

    - #### getNewWorkingConnection

          public static com.rabbitmq.client.Connection getNewWorkingConnection(java.util.Properties env)
                                                                        throws java.lang.Exception

      This function returns a working connection.
      Parameters:
        `env` - - used if it's necessary to create a new connection
      Returns:
        workingConnection
      Throws:
        `java.lang.Exception`

    - #### getNewConnection

          public static com.rabbitmq.client.Connection getNewConnection(java.util.Properties env)
                                                                 throws java.io.IOException,
                                                                        java.security.KeyManagementException,
                                                                        java.security.NoSuchAlgorithmException

      This function creates a new rabbitmq connection using the properties set in env
      Parameters:
        `env` - - Properties needed to create a new connection: username, password, rabbit_host, rabbit_port, enable_ssl (optional)
      Returns:
        new Connection
      Throws:
        `java.io.IOException`
        `java.security.KeyManagementException`
        `java.security.NoSuchAlgorithmException`

    - #### getNewChannel

          public static com.rabbitmq.client.Channel getNewChannel()
                                                           throws java.io.IOException

      This method creates a new channel if the singleton pattern is used
      Returns:
        new Channel
      Throws:
        `java.io.IOException`