Package org.hobbit.core.rabbit
Class DataReceiverImpl.Builder
java.lang.Object
org.hobbit.core.rabbit.DataReceiverImpl.Builder
- Enclosing class:
- DataReceiverImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected DataHandlerprotected RabbitQueueFactoryprotected intprotected RabbitQueueprotected static final Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theDataReceiverImplinstance with the previously given information.dataHandler(DataHandler dataHandler) Sets the handler that is called if data is incoming.maxParallelProcessedMsgs(int maxParallelProcessedMsgs) Sets the maximum number of incoming messages that are processed in parallel.queue(RabbitQueue queue) Sets the queue that is used to receive data.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.
-
Field Details
-
QUEUE_INFO_MISSING_ERROR
- See Also:
-
DATA_HANDLER_MISSING_ERROR
- See Also:
-
dataHandler
-
queue
-
queueName
-
maxParallelProcessedMsgs
protected int maxParallelProcessedMsgs -
factory
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
Sets the queue that is used to receive data.- Parameters:
queue- the queue that is used to receive data- Returns:
- this builder instance
-
queue
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
-
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 theDataReceiverImplinstance 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.
-