Interface QueryResolver

    • Method Detail

      • query

        <R> Optional<R> query​(Query<R> query)
        Sends the Query to all interested Subscribers. This method does not need to return an result.
        Type Parameters:
        R - the type of the result
        Parameters:
        query - the Query to be sent
        Returns:
        an Optional for the Query result
      • queryRequired

        <R> R queryRequired​(Query<R> query)
        Sends the Query to all interested Subscribers. This method expects a valid result.
        Type Parameters:
        R - the type of the result
        Parameters:
        query - the Query to be sent
        Returns:
        the Query result
        Throws:
        UnsupportedOperationException - if not result was received
      • answer

        <T extends Query<?>> SubscriptionId answer​(Class<T> queryClass,
                                                   Consumer<T> responder)
        Adds a new Consumer as Subscriber forthe given Query class.
        Type Parameters:
        T - the type of the query
        Parameters:
        queryClass - the class of the Query
        responder - the Consumer to answer the query
        Returns:
        a SubscriptionId of the Subscriber
      • unsubscribe

        void unsubscribe​(SubscriptionId subscriptionId)
        Method to remove all Consumer matching the SubscriptionId.
        Parameters:
        subscriptionId - the SubscriptionId to remove