Interface QueryHandlerRegistry<S extends QueryHandlerRegistry<S>>

Type Parameters:
S - The type of the registry itself, used for fluent interfacing.
All Known Subinterfaces:
QueryBus
All Known Implementing Classes:
DistributedQueryBus, InterceptingQueryBus, SimpleQueryBus, SimpleQueryHandlingComponent

public interface QueryHandlerRegistry<S extends QueryHandlerRegistry<S>>
Interface describing a registry of query handlers.
Since:
5.0.0
Author:
Allard Buijze, Gerard Klijs, Milan Savic, Mitchell Herrijgers, Sara Pellegrini, Steven van Beelen
  • Method Details

    • subscribe

      default S subscribe(@Nonnull Set<QualifiedName> names, @Nonnull QueryHandler queryHandler)
      Subscribe the given handler for queries and response of the given names.

      If a subscription already exists for any name in the given set, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or new handler gets the subscription.

      Parameters:
      names - The names of the queries the given queryHandler can handle.
      queryHandler - The handler instance that handles queries for the given names.
      Returns:
      This registry for fluent interfacing.
    • subscribe

      S subscribe(@Nonnull QualifiedName queryName, @Nonnull QueryHandler queryHandler)
      Subscribe the given queryHandler for queries and response of the given queryName.

      If a subscription already exists for the queryName, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or new handler gets the subscription.

      Parameters:
      queryName - The fully qualified name of the query
      queryHandler - The handler instance that handles queries for the given queryName.
      Returns:
      This registry for fluent interfacing.
    • subscribe

      default S subscribe(@Nonnull QueryHandlingComponent handlingComponent)
      Subscribe the given handlingComponent with this registry.

      Typically invokes subscribe(Set, QueryHandler), using the QueryHandlingComponent.supportedQueries() as the set of compatible handler names the component in question can deal with.

      Parameters:
      handlingComponent - The query handling component instance to subscribe with this registry.
      Returns:
      This registry for fluent interfacing.