public interface QueryMessage<T,R> extends Message<T>
Handlers should only answer a query if they can respond with the appropriate response type.
Modifier and Type | Method and Description |
---|---|
QueryMessage<T,R> |
andMetaData(Map<String,?> additionalMetaData)
Returns a copy of this QueryMessage with its MetaData merged with given
metaData . |
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
|
static String |
queryName(Object payloadOrMessage)
Extracts the
queryName from the given payloadOrMessage , with three possible outcomes:
The payloadOrMessage is an instance of QueryMessage - getQueryName() is returned.
The payloadOrMessage is an instance of Message - the name of Message.getPayloadType() is returned.
The payloadOrMessage is the query payload - Class.getName() is returned.
|
QueryMessage<T,R> |
withMetaData(Map<String,?> metaData)
Returns a copy of this QueryMessage with the given
metaData . |
getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
String getQueryName()
static String queryName(Object payloadOrMessage)
queryName
from the given payloadOrMessage
, with three possible outcomes:
payloadOrMessage
is an instance of QueryMessage
- getQueryName()
is returned.payloadOrMessage
is an instance of Message
- the name of Message.getPayloadType()
is returned.payloadOrMessage
is the query payload - Class.getName()
is returned.payloadOrMessage
- the object to base the queryName
ongetQueryName()
, the name of Message.getPayloadType()
or the result of
Class.getName()
, depending on the type of the payloadOrMessage
ResponseType<R> getResponseType()
QueryMessage<T,R> withMetaData(Map<String,?> metaData)
metaData
. The payload remains unchanged.withMetaData
in interface Message<T>
metaData
- The new MetaData for the QueryMessageQueryMessage<T,R> andMetaData(Map<String,?> additionalMetaData)
metaData
. The payload remains
unchanged.andMetaData
in interface Message<T>
additionalMetaData
- The MetaData to merge into the QueryMessageCopyright © 2010–2022. All rights reserved.