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.

@FunctionalInterface public interface DuplicateQueryHandlerResolver
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 Type
    Method
    Description
    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.
  • 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 detected
      registeredHandlers - the MessageHandler instances already registered with the Query Bus
      candidateHandler - the MessageHandler that is newly registered and conflicts with the existing registrations
      Returns:
      the resolved MessageHandler instances. It is up to the implementation to discard implementations already in the list
      Throws:
      RuntimeException - when registration should fail