Class LoggingDuplicateCommandHandlerResolver
java.lang.Object
org.axonframework.commandhandling.LoggingDuplicateCommandHandlerResolver
- All Implemented Interfaces:
DuplicateCommandHandlerResolver
public class LoggingDuplicateCommandHandlerResolver
extends Object
implements DuplicateCommandHandlerResolver
Implementation of the DuplicateCommandHandlerResolver that allows registrations to be overridden by new handlers, but
logs this (on WARN level) to a given logger.
- Since:
- 4.2
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptioninstance()Returns an instance that logs duplicate registrations.MessageHandler<? 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 an instance that logs duplicate registrations.- Returns:
- an instance that logs duplicate registrations
-
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
-