public class QuerySerializer extends Object
QueryMessage
and QueryResponseMessage
and Axon Server gRPC
Query
and QueryResponse
messages.Constructor and Description |
---|
QuerySerializer(Serializer messageSerializer,
Serializer serializer,
AxonServerConfiguration configuration)
Instantiate a serializer used to convert Axon
QueryMessage s and QueryResponseMessage s into Axon
Server gRPC messages and vice versa. |
Modifier and Type | Method and Description |
---|---|
<Q,R> QueryMessage<Q,R> |
deserializeRequest(QueryRequest queryRequest)
Convert a
QueryRequest into a QueryMessage . |
<R> QueryResponseMessage<R> |
deserializeResponse(QueryResponse queryResponse)
Convert a
QueryResponse into a QueryResponseMessage . |
<Q,R> QueryRequest |
serializeRequest(QueryMessage<Q,R> queryMessage,
int nrResults,
long timeout,
int priority)
Convert a
QueryMessage into a QueryRequest . |
QueryResponse |
serializeResponse(QueryResponseMessage<?> queryResponse,
String requestMessageId)
Convert a
QueryResponseMessage into a QueryResponse . |
public QuerySerializer(Serializer messageSerializer, Serializer serializer, AxonServerConfiguration configuration)
QueryMessage
s and QueryResponseMessage
s into Axon
Server gRPC messages and vice versa.
The provided messageSerializer
is used for converting a message's payload and metadata, whilst the
serializer
is used to convert a QueryMessage
's
ResponseType
.messageSerializer
- a Serializer
used to de-/serialize an Axon Server gRPC message into QueryMessage
s and QueryResponseMessage
s and vice versaserializer
- a Serializer
used to create a dedicated converter for a QueryMessage
ResponseType
configuration
- an AxonServerConfiguration
used to set the configurable component id and name in
the messagespublic <Q,R> QueryRequest serializeRequest(QueryMessage<Q,R> queryMessage, int nrResults, long timeout, int priority)
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.Q
- a generic specifying the payload type of the given queryMessage
R
- a generic specifying the response type of the given queryMessage
queryMessage
- the QueryMessage
to convert into a QueryRequest
nrResults
- an int
denoting the number of expected resultstimeout
- a long
specifying the timeout in milliseconds of the created QueryRequest
priority
- a int
defining the priority among other QueryRequest
sQueryRequest
based on the provided queryMessage
public QueryResponse serializeResponse(QueryResponseMessage<?> queryResponse, String requestMessageId)
QueryResponseMessage
into a QueryResponse
.queryResponse
- a QueryResponseMessage
to convert into a QueryResponse
requestMessageId
- a String
specifying the identity of the original request messageQueryResponse
based on the provided queryResponse
public <Q,R> QueryMessage<Q,R> deserializeRequest(QueryRequest queryRequest)
QueryRequest
into a QueryMessage
.Q
- a generic specifying the payload type of the QueryMessage
to convert toR
- a generic specifying the response type of the QueryMessage
to convert toqueryRequest
- a QueryRequest
to convert into a QueryMessage
QueryMessage
based on the provided queryRequest
public <R> QueryResponseMessage<R> deserializeResponse(QueryResponse queryResponse)
QueryResponse
into a QueryResponseMessage
.R
- a generic specifying the type of the QueryResponseMessage
to convert toqueryResponse
- a QueryResponse
to convert into a QueryResponseMessage
QueryResponseMessage
based on the provided queryResponse
Copyright © 2010–2019. All rights reserved.