Class FailingDuplicateCommandHandlerResolver
java.lang.Object
org.axonframework.commandhandling.FailingDuplicateCommandHandlerResolver
- All Implemented Interfaces:
DuplicateCommandHandlerResolver
public class FailingDuplicateCommandHandlerResolver
extends Object
implements DuplicateCommandHandlerResolver
Implementation of
DuplicateCommandHandlerResolver that throws a DuplicateCommandHandlerSubscriptionException
when a duplicate registration is detected.- Since:
- 4.2
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptioninstance()Returns a DuplicateCommandHandlerResolver that throws an exception when a duplicate registration is detectedMessageHandler<? super CommandMessage<?>> resolve(String commandName, MessageHandler<? super CommandMessage<?>> registeredHandler, MessageHandler<? super CommandMessage<?>> candidateHandler) Chooses what to do when a duplicate handler is registered, returning the handler that should be selected for command handling, or otherwise throwing an exception to reject registration altogether.
-
Method Details
-
instance
Returns a DuplicateCommandHandlerResolver that throws an exception when a duplicate registration is detected- Returns:
- a DuplicateCommandHandlerResolver that throws an exception when a duplicate registration is detected
-
resolve
public MessageHandler<? super CommandMessage<?>> resolve(@Nonnull String commandName, @Nonnull MessageHandler<? super CommandMessage<?>> registeredHandler, @Nonnull MessageHandler<? super CommandMessage<?>> candidateHandler) Description copied from interface:DuplicateCommandHandlerResolverChooses what to do when a duplicate handler is registered, returning the handler that should be selected for command handling, or otherwise throwing an exception to reject registration altogether.- Specified by:
resolvein interfaceDuplicateCommandHandlerResolver- Parameters:
commandName- The name of the Command for which the duplicate was detectedregisteredHandler- theMessageHandlerpreviously registered with the Command BuscandidateHandler- theMessageHandlerthat is newly registered and conflicts with the existing registration- Returns:
- the resolved
MessageHandler. Could be theregisteredHandler, thecandidateHandleror another handler entirely
-