Interface QueryMessage<T,R>

All Superinterfaces:
Message<T>, Serializable
All Known Subinterfaces:
StreamingQueryMessage<Q,R>, SubscriptionQueryMessage<Q,I,U>
All Known Implementing Classes:
GenericQueryMessage, GenericStreamingQueryMessage, GenericSubscriptionQueryMessage, GrpcBackedQueryMessage, GrpcBackedSubscriptionQueryMessage

public interface QueryMessage<T,R> extends Message<T>
Message type that carries a Query: a request for information. Besides a payload, Query Messages also carry the expected response type. This is the type of result expected by the caller.

Handlers should only answer a query if they can respond with the appropriate response type.

Since:
3.1
Author:
Marc Gathier
  • Method Details

    • getQueryName

      String getQueryName()
      Returns the name identifying the query to be executed.
      Returns:
      the name identifying the query to be executed.
    • queryName

      static String queryName(@Nonnull Object payloadOrMessage)
      Extracts the queryName from the given payloadOrMessage, with three possible outcomes:
      Parameters:
      payloadOrMessage - the object to base the queryName on
      Returns:
      the getQueryName(), the name of Message.getPayloadType() or the result of Class.getName(), depending on the type of the payloadOrMessage
    • getResponseType

      ResponseType<R> getResponseType()
      The type of response expected by the sender of the query
      Returns:
      the type of response expected by the sender of the query
    • withMetaData

      QueryMessage<T,R> withMetaData(@Nonnull Map<String,?> metaData)
      Returns a copy of this QueryMessage with the given metaData. The payload remains unchanged.
      Specified by:
      withMetaData in interface Message<T>
      Parameters:
      metaData - The new MetaData for the QueryMessage
      Returns:
      a copy of this message with the given MetaData
    • andMetaData

      QueryMessage<T,R> andMetaData(@Nonnull Map<String,?> additionalMetaData)
      Returns a copy of this QueryMessage with its MetaData merged with given metaData. The payload remains unchanged.
      Specified by:
      andMetaData in interface Message<T>
      Parameters:
      additionalMetaData - The MetaData to merge into the QueryMessage
      Returns:
      a copy of this message with the given additional MetaData