Package org.hobbit.core.rabbit
Class DataSenderImpl.Builder
- java.lang.Object
-
- org.hobbit.core.rabbit.DataSenderImpl.Builder
-
- Enclosing class:
- DataSenderImpl
public static class DataSenderImpl.Builder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected intdeliveryModeprotected RabbitQueueFactoryfactoryprotected intmessageConfirmBufferprotected RabbitQueuequeueprotected static StringQUEUE_INFO_MISSING_ERRORprotected StringqueueName
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSenderImplbuild()Builds theDataReceiverImplinstance with the previously given information.DataSenderImpl.BuilderdeliveryMode(int deliveryMode)Sets the delivery mode used for the RabbitMQ messages.DataSenderImpl.BuildermessageBuffer(int messageConfirmBuffer)Sets the number of messages that are buffered while waiting for a confirmation that they have been received by the broker.DataSenderImpl.Builderqueue(RabbitQueue queue)Sets the queue that is used to receive data.DataSenderImpl.Builderqueue(RabbitQueueFactory factory, String queueName)Method for providing the necessary information to create a queue if it has not been provided with thequeue(RabbitQueue)method.
-
-
-
Field Detail
-
QUEUE_INFO_MISSING_ERROR
protected static final String QUEUE_INFO_MISSING_ERROR
- See Also:
- Constant Field Values
-
queue
protected RabbitQueue queue
-
queueName
protected String queueName
-
factory
protected RabbitQueueFactory factory
-
messageConfirmBuffer
protected int messageConfirmBuffer
-
deliveryMode
protected int deliveryMode
-
-
Method Detail
-
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 thequeue(RabbitQueue)method. Note that this information is not used if a queue has been provided.- Parameters:
factory- the queue factory used to create a queuequeueName- 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
<1the 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 usesDataSenderImpl.DEFAULT_DELIVERY_MODE.- Parameters:
deliveryMode- the delivery mode used for the RabbitMQ messages- Returns:
- this builder instance
-
build
public DataSenderImpl build() throws IllegalStateException, IOException
Builds theDataReceiverImplinstance 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.
-
-