Package org.axonframework.queryhandling
Interface QueryMessage<T,R>
- All Superinterfaces:
Message<T>,Serializable
- All Known Subinterfaces:
StreamingQueryMessage<Q,,R> SubscriptionQueryMessage<Q,I, U>
- All Known Implementing Classes:
GenericQueryMessage,GenericStreamingQueryMessage,GenericSubscriptionQueryMessage,GrpcBackedQueryMessage,GrpcBackedSubscriptionQueryMessage
Message type that carries a Query: a request for information. Besides a payload, Query Messages also carry the
expected response type. This is the type of result expected by the caller.
Handlers should only answer a query if they can respond with the appropriate response type.
- Since:
- 3.1
- Author:
- Marc Gathier
-
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> additionalMetaData) Returns a copy of this QueryMessage with its MetaData merged with givenmetaData.Returns the name identifying the query to be executed.The type of response expected by the sender of the querystatic StringExtracts thequeryNamefrom the givenpayloadOrMessage, with three possible outcomes: ThepayloadOrMessageis an instance ofQueryMessage-getQueryName()is returned. ThepayloadOrMessageis an instance ofMessage- the name ofMessage.getPayloadType()is returned. ThepayloadOrMessageis the query payload -Class.getName()is returned.withMetaData(Map<String, ?> metaData) Returns a copy of this QueryMessage with the givenmetaData.Methods inherited from interface org.axonframework.messaging.Message
getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Method Details
-
getQueryName
String getQueryName()Returns the name identifying the query to be executed.- Returns:
- the name identifying the query to be executed.
-
queryName
Extracts thequeryNamefrom the givenpayloadOrMessage, with three possible outcomes:- The
payloadOrMessageis an instance ofQueryMessage-getQueryName()is returned. - The
payloadOrMessageis an instance ofMessage- the name ofMessage.getPayloadType()is returned. - The
payloadOrMessageis the query payload -Class.getName()is returned.
- Parameters:
payloadOrMessage- the object to base thequeryNameon- Returns:
- the
getQueryName(), the name ofMessage.getPayloadType()or the result ofClass.getName(), depending on the type of thepayloadOrMessage
- The
-
getResponseType
ResponseType<R> getResponseType()The type of response expected by the sender of the query- Returns:
- the type of response expected by the sender of the query
-
withMetaData
Returns a copy of this QueryMessage with the givenmetaData. The payload remains unchanged.- Specified by:
withMetaDatain interfaceMessage<T>- Parameters:
metaData- The new MetaData for the QueryMessage- Returns:
- a copy of this message with the given MetaData
-
andMetaData
Returns a copy of this QueryMessage with its MetaData merged with givenmetaData. The payload remains unchanged.- Specified by:
andMetaDatain interfaceMessage<T>- Parameters:
additionalMetaData- The MetaData to merge into the QueryMessage- Returns:
- a copy of this message with the given additional MetaData
-