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(io.axoniq.axonserver.grpc.query.QueryRequest queryRequest)
Convert a
QueryRequest into a QueryMessage . |
QueryResponseMessage<?> |
deserializeResponse(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse)
Converts a
QueryResponse into a QueryResponseMessage . |
<R> QueryResponseMessage<R> |
deserializeResponse(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse,
ResponseType<R> expectedResponseType)
Convert a
QueryResponse into a QueryResponseMessage . |
<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 . |
<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 . |
io.axoniq.axonserver.grpc.query.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> io.axoniq.axonserver.grpc.query.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 <Q,R> io.axoniq.axonserver.grpc.query.QueryRequest serializeRequest(QueryMessage<Q,R> queryMessage, int nrResults, long timeout, int priority, boolean stream)
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
sstream
- indicates whether results of this query should be streamed or notQueryRequest
based on the provided queryMessage
public io.axoniq.axonserver.grpc.query.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(io.axoniq.axonserver.grpc.query.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(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse, ResponseType<R> expectedResponseType)
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
public QueryResponseMessage<?> deserializeResponse(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse)
QueryResponse
into a QueryResponseMessage
. It does not assume the type of the
payload.queryResponse
- a QueryResponse
to convert into a QueryResponseMessage
QueryResponseMessage
based on the provided queryResponse
Copyright © 2010–2024. All rights reserved.