Class DurableLocalCommandBus
- java.lang.Object
-
- dk.cloudcreate.essentials.reactive.command.AbstractCommandBus
-
- dk.cloudcreate.essentials.components.foundation.reactive.command.DurableLocalCommandBus
-
- All Implemented Interfaces:
CommandBus
public class DurableLocalCommandBus extends AbstractCommandBus
Provides a JVM local and durable, in regard tosendAndDontWait(Object)/sendAndDontWait(Object, Duration)), variant of theCommandBusconcept
Durability forsendAndDontWait(Object)/sendAndDontWait(Object, Duration)) is delegated toDurableQueues
WhichQueueNamethat is used will be determined by theCommandQueueNameSelectorand theRedeliveryPolicyis determined by theCommandQueueRedeliveryPolicyResolver
Note: If theSendAndDontWaitErrorHandlerprovided doesn't rethrow the exception, then the underlyingDurableQueueswill not be able to retry the command.
Due to this theDurableLocalCommandBusdefaults to using theSendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandler- See Also:
AnnotatedCommandHandler
-
-
Field Summary
-
Fields inherited from class dk.cloudcreate.essentials.reactive.command.AbstractCommandBus
commandHandlers, commandTypeToCommandHandlerCache, interceptors, sendAndDontWaitErrorHandler
-
-
Constructor Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DurableLocalCommandBusBuilderbuilder()Builder for aDurableLocalCommandBusBuilderCommandQueueNameSelectorgetCommandQueueNameSelector()CommandQueueRedeliveryPolicyResolvergetCommandQueueRedeliveryPolicyResolver()intgetParallelSendAndDontWaitConsumers()<C> voidsendAndDontWait(C command)<C> voidsendAndDontWait(C command, Duration delayMessageDelivery)-
Methods inherited from class dk.cloudcreate.essentials.reactive.command.AbstractCommandBus
addCommandHandler, addInterceptor, findCommandHandlerCapableOfHandling, getInterceptors, hasCommandHandler, hasInterceptor, removeCommandHandler, removeInterceptor, send, sendAsync, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface dk.cloudcreate.essentials.reactive.command.CommandBus
addInterceptors
-
-
-
-
Constructor Detail
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues)
Create a newDurableLocalCommandBususing defaults:CommandQueueNameSelector:CommandQueueNameSelector.defaultCommandQueueForAllCommands()CommandQueueRedeliveryPolicyResolver:CommandQueueRedeliveryPolicyResolver.sameReliveryPolicyForAllCommandQueues(RedeliveryPolicy)SendAndDontWaitErrorHandler:SendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandler
- Parameters:
durableQueues- the underlying Durable Queues provider
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, CommandQueueNameSelector commandQueueNameSelector, CommandQueueRedeliveryPolicyResolver commandQueueRedeliveryPolicyResolver)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providercommandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlercommandQueueRedeliveryPolicyResolver- Strategy that allows theDurableLocalCommandBusto vary theRedeliveryPolicyperQueueName
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providersendAndDontWaitErrorHandler- 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
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, CommandQueueNameSelector commandQueueNameSelector, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providercommandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlersendAndDontWaitErrorHandler- 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
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, List<CommandBusInterceptor> interceptors)
Create a newDurableLocalCommandBususing defaults:CommandQueueNameSelector:CommandQueueNameSelector.defaultCommandQueueForAllCommands()CommandQueueRedeliveryPolicyResolver:CommandQueueRedeliveryPolicyResolver.sameReliveryPolicyForAllCommandQueues(RedeliveryPolicy)SendAndDontWaitErrorHandler:SendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandler
- Parameters:
durableQueues- the underlying Durable Queues providerinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, CommandQueueNameSelector commandQueueNameSelector, List<CommandBusInterceptor> interceptors)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providercommandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlerinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler, List<CommandBusInterceptor> interceptors)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providersendAndDontWaitErrorHandler- 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 underlyingDurableQueuesinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, int parallelSendAndDontWaitConsumers, CommandQueueNameSelector commandQueueNameSelector, CommandQueueRedeliveryPolicyResolver commandQueueRedeliveryPolicyResolver, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler, List<CommandBusInterceptor> interceptors)
Create a newDurableLocalCommandBus- Parameters:
durableQueues- the underlying Durable Queues providerparallelSendAndDontWaitConsumers- How many parallelDurableQueuesconsumers should listen for messages added usingsendAndDontWait(Object)/sendAndDontWait(Object, Duration)commandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlercommandQueueRedeliveryPolicyResolver- Strategy that allows theDurableLocalCommandBusto vary theRedeliveryPolicyperQueueNamesendAndDontWaitErrorHandler- 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 underlyingDurableQueuesinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, CommandQueueNameSelector commandQueueNameSelector, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler, List<CommandBusInterceptor> interceptors)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providercommandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlersendAndDontWaitErrorHandler- 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 underlyingDurableQueuesinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, CommandBusInterceptor... interceptors)
Create a newDurableLocalCommandBususing defaults:CommandQueueNameSelector:CommandQueueNameSelector.defaultCommandQueueForAllCommands()CommandQueueRedeliveryPolicyResolver:CommandQueueRedeliveryPolicyResolver.sameReliveryPolicyForAllCommandQueues(RedeliveryPolicy)SendAndDontWaitErrorHandler:SendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandler
- Parameters:
durableQueues- the underlying Durable Queues providerinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, CommandQueueNameSelector commandQueueNameSelector, CommandBusInterceptor... interceptors)
Create a newDurableLocalCommandBususing defaults:- Parameters:
durableQueues- the underlying Durable Queues providercommandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlerinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler, CommandBusInterceptor... interceptors)
Create a newDurableLocalCommandBususing defaults: using defaults:- Parameters:
durableQueues- the underlying Durable Queues providersendAndDontWaitErrorHandler- 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 underlyingDurableQueuesinterceptors- all theCommandBusInterceptor's
-
DurableLocalCommandBus
public DurableLocalCommandBus(DurableQueues durableQueues, int parallelSendAndDontWaitConsumers, CommandQueueNameSelector commandQueueNameSelector, CommandQueueRedeliveryPolicyResolver commandQueueRedeliveryPolicyResolver, SendAndDontWaitErrorHandler sendAndDontWaitErrorHandler, CommandBusInterceptor... interceptors)
Create a newDurableLocalCommandBus- Parameters:
durableQueues- the underlying Durable Queues providerparallelSendAndDontWaitConsumers- How many parallelDurableQueuesconsumers should listen for messages added usingsendAndDontWait(Object)/sendAndDontWait(Object, Duration)commandQueueNameSelector- {The strategy for selecting whichDurableQueuesQueueNameto use for a given combination of command and command handlercommandQueueRedeliveryPolicyResolver- The strategy that allows theDurableLocalCommandBusto vary theRedeliveryPolicyperQueueNamesendAndDontWaitErrorHandler- 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 underlyingDurableQueuesinterceptors- all theCommandBusInterceptor's
-
-
Method Detail
-
builder
public static DurableLocalCommandBusBuilder builder()
Builder for aDurableLocalCommandBusBuilder- Returns:
- builder for a
DurableLocalCommandBusBuilder
-
sendAndDontWait
public <C> void sendAndDontWait(C command)
-
sendAndDontWait
public <C> void sendAndDontWait(C command, Duration delayMessageDelivery)
-
getParallelSendAndDontWaitConsumers
public int getParallelSendAndDontWaitConsumers()
-
getCommandQueueNameSelector
public CommandQueueNameSelector getCommandQueueNameSelector()
-
getCommandQueueRedeliveryPolicyResolver
public CommandQueueRedeliveryPolicyResolver getCommandQueueRedeliveryPolicyResolver()
-
-