Class DataReceiverImpl.Builder

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

public static class DataReceiverImpl.Builder extends Object
  • Field Details

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • dataHandler

      public DataReceiverImpl.Builder dataHandler(DataHandler dataHandler)
      Sets the handler that is called if data is incoming.
      Parameters:
      dataHandler - the handler that is called if data is incoming
      Returns:
      this builder instance
    • queue

      public DataReceiverImpl.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 DataReceiverImpl.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
    • maxParallelProcessedMsgs

      public DataReceiverImpl.Builder maxParallelProcessedMsgs(int maxParallelProcessedMsgs)
      Sets the maximum number of incoming messages that are processed in parallel. Additional messages have to wait in the queue.
      Parameters:
      maxParallelProcessedMsgs - the maximum number of incoming messages that are processed in parallel
      Returns:
      this builder instance
    • build

      Builds the DataReceiverImpl instance with the previously given information.
      Returns:
      The newly created DataReceiver instance
      Throws:
      IllegalStateException - if the dataHandler is missing or 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 or if the given queue can not be configured by the newly created DataReceiver. Note that in the latter case the queue will be closed.