java.lang.Object
dk.cloudcreate.essentials.components.foundation.reactive.command.DurableLocalCommandBusBuilder

public class DurableLocalCommandBusBuilder extends Object
  • Constructor Details

    • DurableLocalCommandBusBuilder

      public DurableLocalCommandBusBuilder()
  • Method Details

    • 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 parallel DurableQueues consumers should listen for messages added using CommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)
      Defaults to 10
      Parameters:
      parallelSendAndDontWaitConsumers - How many parallel DurableQueues consumers should listen for messages added using CommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)
      Returns:
      this builder instance
    • setCommandQueueName

      public DurableLocalCommandBusBuilder setCommandQueueName(QueueName commandQueueName)
      Set the name of the DurableQueues that will be used queuing commands sent using DurableLocalCommandBus.sendAndDontWait(Object)
      Defaults to DurableLocalCommandBus.DEFAULT_COMMAND_QUEUE_NAME
      Parameters:
      commandQueueName - Set the name of the DurableQueues that will be used to store asynchronous commands sent using DurableLocalCommandBus.sendAndDontWait(Object)
      Returns:
      this builder instance
    • setCommandQueueRedeliveryPolicy

      public DurableLocalCommandBusBuilder setCommandQueueRedeliveryPolicy(RedeliveryPolicy commandQueueRedeliveryPolicy)
      Set the RedeliveryPolicy used when handling queued commands sent using DurableLocalCommandBus.sendAndDontWait(Object) Defaults to DurableLocalCommandBus.DEFAULT_REDELIVERY_POLICY.
      Example:
      
       RedeliveryPolicy.linearBackoff(Duration.ofMillis(150),
                                      Duration.ofMillis(1000),
                                      20)
       
      Parameters:
      commandQueueRedeliveryPolicy - The strategy that allows the DurableLocalCommandBus to vary the RedeliveryPolicy per QueueName
      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 during CommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration). If this handler doesn't rethrow the exeption, then the message will not be retried by the underlying DurableQueues
      Parameters:
      sendAndDontWaitErrorHandler - The Exception handler that will handle errors that occur during CommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration). If this handler doesn't rethrow the exeption, then the message will not be retried by the underlying DurableQueues
      Returns:
      this builder instance
    • setInterceptors

      public DurableLocalCommandBusBuilder setInterceptors(List<dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor> interceptors)
      Set all the CommandBusInterceptor's to use
      Parameters:
      interceptors - all the CommandBusInterceptor's to use
      Returns:
      this builder instance
    • setInterceptors

      public DurableLocalCommandBusBuilder setInterceptors(dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor... interceptors)
      Set all the CommandBusInterceptor's to use
      Parameters:
      interceptors - all the CommandBusInterceptor's to use
      Returns:
      this builder instance
    • addInterceptors

      public DurableLocalCommandBusBuilder addInterceptors(List<dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor> interceptors)
      Add additional CommandBusInterceptor's to use
      Parameters:
      interceptors - the additional CommandBusInterceptor's to use
      Returns:
      this builder instance
    • addInterceptors

      public DurableLocalCommandBusBuilder addInterceptors(dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptor... interceptors)
      Add additional CommandBusInterceptor's to use
      Parameters:
      interceptors - the additional CommandBusInterceptor's to use
      Returns:
      this builder instance
    • build

      public DurableLocalCommandBus build()