org.apache.nutch.rabbitmq

## Class RabbitMQClient

- java.lang.Object
- - org.apache.nutch.rabbitmq.RabbitMQClient

-     public class RabbitMQClient
      extends java.lang.Object

  Client for RabbitMQ

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RabbitMQClient(java.lang.String uri)` Builds a new instance of `RabbitMQClient`
    `RabbitMQClient(java.lang.String serverHost, int serverPort, java.lang.String serverVirtualHost, java.lang.String serverUsername, java.lang.String serverPassword)` Builds a new instance of `RabbitMQClient`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bind(java.lang.String exchangeName, java.lang.String exchangeOptions, java.lang.String queueName, java.lang.String queueOptions, java.lang.String bindingKey, java.lang.String bindingArguments)` Creates a relationship between an exchange and a queue.
    `void` | `close()` Closes the channel and the connection with the server.
    `void` | `openChannel()` Opens a new channel into the opened connection.
    `void` | `publish(java.lang.String exchangeName, java.lang.String routingKey, RabbitMQMessage message)` Publishes a new message over an exchange.

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

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

- - ### Constructor Detail

    - #### RabbitMQClient

          public RabbitMQClient(java.lang.String serverHost,
                                int serverPort,
                                java.lang.String serverVirtualHost,
                                java.lang.String serverUsername,
                                java.lang.String serverPassword)
                         throws java.io.IOException

      Builds a new instance of `RabbitMQClient`
      Parameters:
        `serverHost` - The server host.
        `serverPort` - The server port.
        `serverVirtualHost` - The virtual host into the RabbitMQ server.
        `serverUsername` - The username to access the server.
        `serverPassword` - The password to access the server.
      Throws:
        `java.io.IOException` - It is thrown if there is some issue during the connection creation.

    - #### RabbitMQClient

          public RabbitMQClient(java.lang.String uri)
                         throws java.io.IOException

      Builds a new instance of `RabbitMQClient`
      Parameters:
        `uri` - The connection parameters in the form amqp://userName:password@hostName:portNumber/virtualHost
      Throws:
        `java.io.IOException` - It is thrown if there is some issue during the connection creation.

  - ### Method Detail

    - #### openChannel

          public void openChannel()
                           throws java.io.IOException

      Opens a new channel into the opened connection.
      Throws:
        `java.io.IOException` - It is thrown if there is some issue during the channel creation.

    - #### bind

          public void bind(java.lang.String exchangeName,
                           java.lang.String exchangeOptions,
                           java.lang.String queueName,
                           java.lang.String queueOptions,
                           java.lang.String bindingKey,
                           java.lang.String bindingArguments)
                    throws java.io.IOException

      Creates a relationship between an exchange and a queue.
      Parameters:
        `exchangeName` - The exchange's name.
        `exchangeOptions` - Options used when the exchange is created.
        It must have the form type={type},durable={durable} where:
        - {type} is fanout, direct, headers or topic
        - {durable} is true or false
        `queueName` - The queue's name.
        `queueOptions` - Options used when the queue is created.
        It must have the form durable={type},exclusive={durable},auto-delete={durable},arguments={durable} where:
        - durable is true or false
        - exclusive is true or false
        - auto-delete is true or false
        - arguments must have the for {key1:value1;key2:value2}
        `bindingKey` - The routine key to use for the binding.
        `bindingArguments` - This parameter is only used when the exchange's type is headers. In other cases is ignored.
        It must have the form key1=value1,key2=value2
      Throws:
        `java.io.IOException` - If there is some issue creating the relationship.

    - #### publish

          public void publish(java.lang.String exchangeName,
                              java.lang.String routingKey,
                              RabbitMQMessage message)
                       throws java.io.IOException

      Publishes a new message over an exchange.
      Parameters:
        `exchangeName` - The exchange's name where the message will be published.
        `routingKey` - The routing key used to route the message in the exchange.
        `message` - The message itself.
      Throws:
        `java.io.IOException` - If there is some issue publishing the message.

    - #### close

          public void close()
                     throws java.io.IOException

      Closes the channel and the connection with the server.
      Throws:
        `java.io.IOException` - If there is some issue trying to close the channel or connection.

Copyright © 2019 The Apache Software Foundation