Class DataSenderImpl.Builder

java.lang.Object
org.hobbit.core.rabbit.DataSenderImpl.Builder
Enclosing class:
DataSenderImpl

public static class DataSenderImpl.Builder extends Object
  • Field Details

    • QUEUE_INFO_MISSING_ERROR

      protected static final String QUEUE_INFO_MISSING_ERROR
      See Also:
    • queue

      protected RabbitQueue queue
    • queueName

      protected String queueName
    • factory

      protected RabbitQueueFactory factory
    • messageConfirmBuffer

      protected int messageConfirmBuffer
    • deliveryMode

      protected int deliveryMode
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • queue

      public DataSenderImpl.Builder queue(RabbitQueue queue)
      Sets the queue that is used to receive data.
      Parameters:
      queue - the queue that is used to receive data
      Returns:
      this builder instance
    • queue

      public DataSenderImpl.Builder queue(RabbitQueueFactory factory, String queueName)
      Method for providing the necessary information to create a queue if it has not been provided with the queue(RabbitQueue) method. Note that this information is not used if a queue has been provided.
      Parameters:
      factory - the queue factory used to create a queue
      queueName - the name of the newly created queue
      Returns:
      this builder instance
    • messageBuffer

      public DataSenderImpl.Builder messageBuffer(int messageConfirmBuffer)

      Sets the number of messages that are buffered while waiting for a confirmation that they have been received by the broker. Note that if the message buffer has reached is maximum size, the sender will block until confirmations are received.

      If the given message buffer size is <1 the usage of confirmation messages is turned off.

      Parameters:
      messageConfirmBuffer - the size of the messages buffer
      Returns:
      this builder instance
    • deliveryMode

      public DataSenderImpl.Builder deliveryMode(int deliveryMode)
      Sets the delivery mode used for the RabbitMQ messages. Please have a look into the RabbitMQ documentation to see the different meanings of the values. By default, the sender uses DataSenderImpl.DEFAULT_DELIVERY_MODE.
      Parameters:
      deliveryMode - the delivery mode used for the RabbitMQ messages
      Returns:
      this builder instance
    • build

      Builds the DataReceiverImpl instance with the previously given information.
      Returns:
      The newly created DataReceiver instance
      Throws:
      IllegalStateException - if neither a queue nor the information needed to create a queue have been provided.
      IOException - if an exception is thrown while creating a new queue.