Class QueryResolverImpl

    • Method Detail

      • answer

        public <T extends Query<?>> SubscriptionId answer​(Class<T> queryClass,
                                                          Consumer<T> responder)
        Description copied from interface: QueryResolver
        Adds a new Consumer as Subscriber forthe given Query class.
        Specified by:
        answer in interface QueryResolver
        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
      • query

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

        public <R> R queryRequired​(Query<R> query)
        Description copied from interface: QueryResolver
        Sends the Query to all interested Subscribers. This method expects a valid result.
        Specified by:
        queryRequired in interface QueryResolver
        Type Parameters:
        R - the type of the result
        Parameters:
        query - the Query to be sent
        Returns:
        the Query result
      • unsubscribe

        public void unsubscribe​(SubscriptionId subscriptionId)
        Description copied from interface: QueryResolver
        Method to remove all Consumer matching the SubscriptionId.
        Specified by:
        unsubscribe in interface QueryResolver
        Parameters:
        subscriptionId - the SubscriptionId to remove