Class ConsumeFromQueueBuilder
java.lang.Object
dk.cloudcreate.essentials.components.foundation.messaging.queue.operations.ConsumeFromQueueBuilder
Builder for
ConsumeFromQueue-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builder anConsumeFromQueueinstance from the builder propertiessetConsumerExecutorService(ScheduledExecutorService consumerExecutorService) setConsumerName(String consumerName) setParallelConsumers(int parallelConsumers) setPollingInterval(Duration pollingInterval) setQueueMessageHandler(QueuedMessageHandler queueMessageHandler) setQueueName(QueueName queueName) setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
-
Constructor Details
-
ConsumeFromQueueBuilder
public ConsumeFromQueueBuilder()
-
-
Method Details
-
setQueueName
- Parameters:
queueName- the name of the queue that the consumer will be listening for queued messages ready to be delivered to theQueuedMessageHandlerprovided- Returns:
- this builder instance
-
setPollingInterval
- Parameters:
pollingInterval- the interval with which the consumer poll the queue db for new messages to process- Returns:
- this builder instance
-
setConsumerName
- Parameters:
consumerName- the name of the consumer (for logging purposes)- Returns:
- this builder instance
-
setRedeliveryPolicy
- Parameters:
redeliveryPolicy- the redelivery policy in case the handling of a message fails- Returns:
- this builder instance
-
setParallelConsumers
- Parameters:
parallelConsumers- the number of parallel consumers (if number > 1 then you will effectively have competing consumers on the current node)
Optional if you providesetConsumerExecutorService(ScheduledExecutorService)instead- Returns:
- this builder instance
-
setConsumerExecutorService
public ConsumeFromQueueBuilder setConsumerExecutorService(ScheduledExecutorService consumerExecutorService) - Parameters:
consumerExecutorService- theScheduledExecutorServicethat's responsible for controlling the number of Message consumer instance. E.g. if you provide anExecutors.newSingleThreadExecutor()then there will only be a single message handler instance running on the local node. Also seeThreadFactoryBuilder
Optional if you providesetParallelConsumers(int)instead- Returns:
- this builder instance
-
setQueueMessageHandler
- Parameters:
queueMessageHandler- the message handler that will receiveQueuedMessage's- Returns:
- this builder instance
-
build
Builder anConsumeFromQueueinstance from the builder properties- Returns:
- the
ConsumeFromQueueinstance
-