Interface DuplicateQueryHandlerResolver
- All Known Implementing Classes:
FailingDuplicateQueryHandlerResolver,LoggingDuplicateQueryHandlerResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface towards resolving the occurrence of a duplicate query handler being subscribed. As such it
ingests two
MessageHandler instances and returns a list with the wanted handlers- Since:
- 4.6.0
- Author:
- Mitchell Herrijgers
-
Method Summary
Modifier and TypeMethodDescriptionresolve(String queryName, Type responseType, List<QuerySubscription<?>> registeredHandlers, QuerySubscription<?> candidateHandler) Chooses what to do when a duplicate handler is registered, returning the handlers that should be selected for query handling, or otherwise throwing an exception to reject registration altogether.
-
Method Details
-
resolve
List<QuerySubscription<?>> resolve(String queryName, Type responseType, List<QuerySubscription<?>> registeredHandlers, QuerySubscription<?> candidateHandler) Chooses what to do when a duplicate handler is registered, returning the handlers that should be selected for query handling, or otherwise throwing an exception to reject registration altogether.- Parameters:
queryName- The name of the query for which the duplicate was detectedregisteredHandlers- theMessageHandlerinstances already registered with the Query BuscandidateHandler- theMessageHandlerthat is newly registered and conflicts with the existing registrations- Returns:
- the resolved
MessageHandlerinstances. It is up to the implementation to discard implementations already in the list - Throws:
RuntimeException- when registration should fail
-