Interface QueryHandler

  • 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 QueryHandler
    Interface representing a component that can handle queries.
    • Method Detail

      • stream

        default FlowControl stream​(QueryRequest query,
                                   ReplyChannel<QueryResponse> responseHandler)
        Handle the given query, using the given responseHandler to send the response(s). This operation is flow control aware, hence messages should be sent via responseHandler when requested.

        Note that the query must be completed using ReplyChannel.complete() or ReplyChannel.sendLast(Object).

        Parameters:
        query - the message representing the query request
        responseHandler - the handler to send responses with
        Returns:
        a FlowControl to request more responses and cancel sending responses
      • registerSubscriptionQuery

        default Registration registerSubscriptionQuery​(SubscriptionQuery query,
                                                       QueryHandler.UpdateHandler updateHandler)
        Registers an incoming subscription query request, represented by given query, using given updateHandler to send updates when the projection for this query changes.

        If this handler doesn't support subscription queries for the given query, it should return null. Otherwise, it must return a handle that can be used to cancel the subscription query.

        Parameters:
        query - the message representing the query
        updateHandler - to handler to send updates with
        Returns:
        a registration to cancel the subscription, or null if this handler doesn't support the subscription query