Class DurableLocalCommandBusBuilder
- java.lang.Object
-
- dk.cloudcreate.essentials.components.foundation.reactive.command.DurableLocalCommandBusBuilder
-
public class DurableLocalCommandBusBuilder extends Object
Builder forDurableLocalCommandBus
-
-
Constructor Summary
Constructors Constructor Description DurableLocalCommandBusBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DurableLocalCommandBusBuilderaddInterceptors(dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor... interceptors)Add additionalCommandBusInterceptor's to useDurableLocalCommandBusBuilderaddInterceptors(List<dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor> interceptors)Add additionalCommandBusInterceptor's to useDurableLocalCommandBusbuild()DurableLocalCommandBusBuildersetCommandQueueName(QueueName commandQueueName)Set the name of theDurableQueuesthat will be used queuing commands sent usingDurableLocalCommandBus.sendAndDontWait(Object)
Defaults toDurableLocalCommandBus.DEFAULT_COMMAND_QUEUE_NAMEDurableLocalCommandBusBuildersetCommandQueueRedeliveryPolicy(RedeliveryPolicy commandQueueRedeliveryPolicy)Set theRedeliveryPolicyused when handling queued commands sent usingDurableLocalCommandBus.sendAndDontWait(Object)Defaults toDurableLocalCommandBus.DEFAULT_REDELIVERY_POLICY.
Example:DurableLocalCommandBusBuildersetDurableQueues(DurableQueues durableQueues)Set the underlying Durable Queues providerDurableLocalCommandBusBuildersetInterceptors(dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor... interceptors)Set all theCommandBusInterceptor's to useDurableLocalCommandBusBuildersetInterceptors(List<dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor> interceptors)Set all theCommandBusInterceptor's to useDurableLocalCommandBusBuildersetParallelSendAndDontWaitConsumers(int parallelSendAndDontWaitConsumers)Set how many parallelDurableQueuesconsumers should listen for messages added usingCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)
Defaults to 10DurableLocalCommandBusBuildersetSendAndDontWaitErrorHandler(dk.cloudcreate.essentials.reactive.command.SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler)Set the Exception handler that will handle errors that occur duringCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration).
-
-
-
Method Detail
-
setDurableQueues
public DurableLocalCommandBusBuilder setDurableQueues(DurableQueues durableQueues)
Set the underlying Durable Queues provider- Parameters:
durableQueues- the underlying Durable Queues provider- Returns:
- this builder instance
-
setParallelSendAndDontWaitConsumers
public DurableLocalCommandBusBuilder setParallelSendAndDontWaitConsumers(int parallelSendAndDontWaitConsumers)
Set how many parallelDurableQueuesconsumers should listen for messages added usingCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)
Defaults to 10- Parameters:
parallelSendAndDontWaitConsumers- How many parallelDurableQueuesconsumers should listen for messages added usingCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)- Returns:
- this builder instance
-
setCommandQueueName
public DurableLocalCommandBusBuilder setCommandQueueName(QueueName commandQueueName)
Set the name of theDurableQueuesthat will be used queuing commands sent usingDurableLocalCommandBus.sendAndDontWait(Object)
Defaults toDurableLocalCommandBus.DEFAULT_COMMAND_QUEUE_NAME- Parameters:
commandQueueName- Set the name of theDurableQueuesthat will be used to store asynchronous commands sent usingDurableLocalCommandBus.sendAndDontWait(Object)- Returns:
- this builder instance
-
setCommandQueueRedeliveryPolicy
public DurableLocalCommandBusBuilder setCommandQueueRedeliveryPolicy(RedeliveryPolicy commandQueueRedeliveryPolicy)
Set theRedeliveryPolicyused when handling queued commands sent usingDurableLocalCommandBus.sendAndDontWait(Object)Defaults toDurableLocalCommandBus.DEFAULT_REDELIVERY_POLICY.
Example:RedeliveryPolicy.linearBackoff(Duration.ofMillis(150), Duration.ofMillis(1000), 20)- Parameters:
commandQueueRedeliveryPolicy- The strategy that allows theDurableLocalCommandBusto vary theRedeliveryPolicyperQueueName- Returns:
- this builder instance
-
setSendAndDontWaitErrorHandler
public DurableLocalCommandBusBuilder setSendAndDontWaitErrorHandler(dk.cloudcreate.essentials.reactive.command.SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler)
Set the Exception handler that will handle errors that occur duringCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration). If this handler doesn't rethrow the exeption, then the message will not be retried by the underlyingDurableQueues- Parameters:
sendAndDontWaitErrorHandler- The Exception handler that will handle errors that occur duringCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration). If this handler doesn't rethrow the exeption, then the message will not be retried by the underlyingDurableQueues- Returns:
- this builder instance
-
setInterceptors
public DurableLocalCommandBusBuilder setInterceptors(List<dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor> interceptors)
Set all theCommandBusInterceptor's to use- Parameters:
interceptors- all theCommandBusInterceptor's to use- Returns:
- this builder instance
-
setInterceptors
public DurableLocalCommandBusBuilder setInterceptors(dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor... interceptors)
Set all theCommandBusInterceptor's to use- Parameters:
interceptors- all theCommandBusInterceptor's to use- Returns:
- this builder instance
-
addInterceptors
public DurableLocalCommandBusBuilder addInterceptors(List<dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor> interceptors)
Add additionalCommandBusInterceptor's to use- Parameters:
interceptors- the additionalCommandBusInterceptor's to use- Returns:
- this builder instance
-
addInterceptors
public DurableLocalCommandBusBuilder addInterceptors(dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor... interceptors)
Add additionalCommandBusInterceptor's to use- Parameters:
interceptors- the additionalCommandBusInterceptor's to use- Returns:
- this builder instance
-
build
public DurableLocalCommandBus build()
-
-