Class DataReceiverImpl.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • 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

        public DataReceiverImpl build()
                               throws IllegalStateException,
                                      IOException
        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.