Q
- a generic specifying the type of the QueryMessage
's payloadR
- a generic specifying the expected response type of the QueryMessage
public class GrpcBackedQueryMessage<Q,R> extends Object implements QueryMessage<Q,R>
QueryRequest
as a QueryMessage
.Constructor and Description |
---|
GrpcBackedQueryMessage(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. |
Modifier and Type | Method and Description |
---|---|
GrpcBackedQueryMessage<Q,R> |
andMetaData(Map<String,?> metaData)
Returns a copy of this QueryMessage with its MetaData merged with given
metaData . |
String |
getIdentifier()
Returns the identifier of this message.
|
MetaData |
getMetaData()
Returns the meta data for this event.
|
Q |
getPayload()
Returns the payload of this Event.
|
Class<Q> |
getPayloadType()
Returns the type of the payload.
|
String |
getQueryName()
Returns the name identifying the query to be executed.
|
ResponseType<R> |
getResponseType()
The type of response expected by the sender of the query
|
GrpcBackedQueryMessage<Q,R> |
withMetaData(Map<String,?> metaData)
Returns a copy of this QueryMessage with the given
metaData . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
queryName
serializeMetaData, serializePayload
public GrpcBackedQueryMessage(QueryRequest queryRequest, Serializer messageSerializer, Serializer serializer)
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.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 typepublic String getQueryName()
QueryMessage
getQueryName
in interface QueryMessage<Q,R>
public ResponseType<R> getResponseType()
QueryMessage
getResponseType
in interface QueryMessage<Q,R>
public String getIdentifier()
Message
getIdentifier
in interface Message<Q>
public MetaData getMetaData()
Message
getMetaData
in interface Message<Q>
public Q getPayload()
Message
getPayload
in interface Message<Q>
public Class<Q> getPayloadType()
Message
getPayload().getClass()
, but allows implementations to optimize by using
lazy loading or deserialization.getPayloadType
in interface Message<Q>
public GrpcBackedQueryMessage<Q,R> withMetaData(Map<String,?> metaData)
QueryMessage
metaData
. The payload remains unchanged.withMetaData
in interface Message<Q>
withMetaData
in interface QueryMessage<Q,R>
metaData
- The new MetaData for the QueryMessagepublic GrpcBackedQueryMessage<Q,R> andMetaData(Map<String,?> metaData)
QueryMessage
metaData
. The payload remains
unchanged.andMetaData
in interface Message<Q>
andMetaData
in interface QueryMessage<Q,R>
metaData
- The MetaData to merge into the QueryMessageCopyright © 2010–2020. All rights reserved.