Class GrpcBackedQueryMessage<Q,R>

java.lang.Object
org.axonframework.axonserver.connector.query.GrpcBackedQueryMessage<Q,R>
Type Parameters:
Q - a generic specifying the type of the QueryMessage's payload
R - a generic specifying the expected response type of the QueryMessage
All Implemented Interfaces:
Serializable, Message<Q>, QueryMessage<Q,R>

public class GrpcBackedQueryMessage<Q,R> extends Object implements QueryMessage<Q,R>
Wrapper that allows clients to access a gRPC QueryRequest as a QueryMessage.
Since:
4.0
Author:
Marc Gathier
See Also:
  • Constructor Details

    • GrpcBackedQueryMessage

      public GrpcBackedQueryMessage(io.axoniq.axonserver.grpc.query.QueryRequest queryRequest, Serializer messageSerializer, Serializer serializer)
      Instantiate a GrpcBackedResponseMessage with the given queryRequest, using the provided messageSerializer to be able to retrieve the payload and MetaData from it. The serializer is solely used to deserialize the response type.
      Parameters:
      queryRequest - the QueryRequest which is being wrapped as a QueryMessage
      messageSerializer - the Serializer used to deserialize the payload and MetaData from the given queryRequest
      serializer - the Serializer used to deserialize the response type
  • Method Details

    • getQueryName

      public String getQueryName()
      Description copied from interface: QueryMessage
      Returns the name identifying the query to be executed.
      Specified by:
      getQueryName in interface QueryMessage<Q,R>
      Returns:
      the name identifying the query to be executed.
    • getResponseType

      public ResponseType<R> getResponseType()
      Description copied from interface: QueryMessage
      The type of response expected by the sender of the query
      Specified by:
      getResponseType in interface QueryMessage<Q,R>
      Returns:
      the type of response expected by the sender of the query
    • getIdentifier

      public String getIdentifier()
      Description copied from interface: Message
      Returns the identifier of this message. Two messages with the same identifiers should be interpreted as different representations of the same conceptual message. In such case, the meta-data may be different for both representations. The payload may be identical.
      Specified by:
      getIdentifier in interface Message<Q>
      Returns:
      the unique identifier of this message
    • getMetaData

      public MetaData getMetaData()
      Description copied from interface: Message
      Returns the meta data for this message. This meta data is a collection of key-value pairs, where the key is a String, and the value is a serializable object.
      Specified by:
      getMetaData in interface Message<Q>
      Returns:
      the meta data for this message
    • getPayload

      public Q getPayload()
      Description copied from interface: Message
      Returns the payload of this message. The payload is the application-specific information.
      Specified by:
      getPayload in interface Message<Q>
      Returns:
      the payload of this message
    • getPayloadType

      public Class<Q> getPayloadType()
      Description copied from interface: Message
      Returns the type of the payload.

      Is semantically equal to getPayload().getClass(), but allows implementations to optimize by using lazy loading or deserialization.

      Specified by:
      getPayloadType in interface Message<Q>
      Returns:
      the type of payload.
    • withMetaData

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

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