Class QuerySerializer

java.lang.Object
org.axonframework.axonserver.connector.query.QuerySerializer

public class QuerySerializer extends Object
Converter between Axon Framework QueryMessage and QueryResponseMessage and Axon Server gRPC Query and QueryResponse messages.
Since:
4.0
Author:
Marc Gathier
  • Constructor Details

  • Method Details

    • serializeRequest

      public <Q, R> io.axoniq.axonserver.grpc.query.QueryRequest serializeRequest(QueryMessage<Q,R> queryMessage, int nrResults, long timeout, int priority)
      Convert a QueryMessage into a QueryRequest. The provided nrResults, timeout and priority are all set on the QueryRequest to respectively define the number of results, after which time the query should be aborted and the priority of the query amont others.
      Type Parameters:
      Q - a generic specifying the payload type of the given queryMessage
      R - a generic specifying the response type of the given queryMessage
      Parameters:
      queryMessage - the QueryMessage to convert into a QueryRequest
      nrResults - an int denoting the number of expected results
      timeout - a long specifying the timeout in milliseconds of the created QueryRequest
      priority - a int defining the priority among other QueryRequests
      Returns:
      a QueryRequest based on the provided queryMessage
    • serializeRequest

      public <Q, R> io.axoniq.axonserver.grpc.query.QueryRequest serializeRequest(QueryMessage<Q,R> queryMessage, int nrResults, long timeout, int priority, boolean stream)
      Convert a QueryMessage into a QueryRequest. The provided nrResults, timeout and priority are all set on the QueryRequest to respectively define the number of results, after which time the query should be aborted and the priority of the query amont others.
      Type Parameters:
      Q - a generic specifying the payload type of the given queryMessage
      R - a generic specifying the response type of the given queryMessage
      Parameters:
      queryMessage - the QueryMessage to convert into a QueryRequest
      nrResults - an int denoting the number of expected results
      timeout - a long specifying the timeout in milliseconds of the created QueryRequest
      priority - a int defining the priority among other QueryRequests
      stream - indicates whether results of this query should be streamed or not
      Returns:
      a QueryRequest based on the provided queryMessage
    • serializeResponse

      public io.axoniq.axonserver.grpc.query.QueryResponse serializeResponse(QueryResponseMessage<?> queryResponse, String requestMessageId)
      Convert a QueryResponseMessage into a QueryResponse.
      Parameters:
      queryResponse - a QueryResponseMessage to convert into a QueryResponse
      requestMessageId - a String specifying the identity of the original request message
      Returns:
      a QueryResponse based on the provided queryResponse
    • deserializeRequest

      public <Q, R> QueryMessage<Q,R> deserializeRequest(io.axoniq.axonserver.grpc.query.QueryRequest queryRequest)
      Convert a QueryRequest into a QueryMessage.
      Type Parameters:
      Q - a generic specifying the payload type of the QueryMessage to convert to
      R - a generic specifying the response type of the QueryMessage to convert to
      Parameters:
      queryRequest - a QueryRequest to convert into a QueryMessage
      Returns:
      a QueryMessage based on the provided queryRequest
    • deserializeResponse

      public <R> QueryResponseMessage<R> deserializeResponse(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse, ResponseType<R> expectedResponseType)
      Convert a QueryResponse into a QueryResponseMessage.
      Type Parameters:
      R - a generic specifying the type of the QueryResponseMessage to convert to
      Parameters:
      queryResponse - a QueryResponse to convert into a QueryResponseMessage
      Returns:
      a QueryResponseMessage based on the provided queryResponse
    • deserializeResponse

      public QueryResponseMessage<?> deserializeResponse(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse)
      Converts a QueryResponse into a QueryResponseMessage. It does not assume the type of the payload.
      Parameters:
      queryResponse - a QueryResponse to convert into a QueryResponseMessage
      Returns:
      a QueryResponseMessage based on the provided queryResponse