Package org.axonframework.queryhandling
Class GenericQueryMessage<T,R>
java.lang.Object
org.axonframework.messaging.MessageDecorator<T>
org.axonframework.queryhandling.GenericQueryMessage<T,R>
- Type Parameters:
T- The type of payload expressing the query in this messageR- The type of response expected from this query
- All Implemented Interfaces:
Serializable,Message<T>,QueryMessage<T,R>
- Direct Known Subclasses:
GenericStreamingQueryMessage,GenericSubscriptionQueryMessage
Generic implementation of the QueryMessage. Unless explicitly provided, it assumes the
queryName of the
message is the fully qualified class name of the message's payload.- Since:
- 3.1
- Author:
- Marc Gathier
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGenericQueryMessage(Message<T> delegate, String queryName, ResponseType<R> responseType) Initialize the Query Message, using givendelegateas the carrier of payload and metadata and givenqueryNameand expecting the givenresponseType.GenericQueryMessage(T payload, String queryName, ResponseType<R> responseType) Initializes the message with the givenpayload,queryNameand expectedresponseType.GenericQueryMessage(T payload, ResponseType<R> responseType) Initializes the message with the givenpayloadand expectedresponseType. -
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> metaData) Returns a copy of this QueryMessage with its MetaData merged with givenmetaData.protected voiddescribeTo(StringBuilder stringBuilder) Describe the message specific properties to the givenstringBuilder.protected StringDescribe the type of message, used inMessageDecorator.toString().Returns the name identifying the query to be executed.The type of response expected by the sender of the querywithMetaData(Map<String, ?> metaData) Returns a copy of this QueryMessage with the givenmetaData.Methods inherited from class org.axonframework.messaging.MessageDecorator
getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.messaging.Message
getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Constructor Details
-
GenericQueryMessage
Initializes the message with the givenpayloadand expectedresponseType. The query name is set to the fully qualified class name of thepayload.- Parameters:
payload- The payload expressing the queryresponseType- The expected response type of typeResponseType
-
GenericQueryMessage
Initializes the message with the givenpayload,queryNameand expectedresponseType.- Parameters:
payload- The payload expressing the queryqueryName- The name identifying the query to executeresponseType- The expected response type of typeResponseType
-
GenericQueryMessage
Initialize the Query Message, using givendelegateas the carrier of payload and metadata and givenqueryNameand expecting the givenresponseType.- Parameters:
delegate- The message containing the payload and meta data for this messagequeryName- The name identifying the query to executeresponseType- The expected response type of typeResponseType
-
-
Method Details
-
getQueryName
Description copied from interface:QueryMessageReturns the name identifying the query to be executed.- Specified by:
getQueryNamein interfaceQueryMessage<T,R> - Returns:
- the name identifying the query to be executed.
-
getResponseType
Description copied from interface:QueryMessageThe type of response expected by the sender of the query- Specified by:
getResponseTypein interfaceQueryMessage<T,R> - Returns:
- the type of response expected by the sender of the query
-
withMetaData
Description copied from interface:QueryMessageReturns a copy of this QueryMessage with the givenmetaData. The payload remains unchanged.- Specified by:
withMetaDatain interfaceMessage<T>- Specified by:
withMetaDatain interfaceQueryMessage<T,R> - Parameters:
metaData- The new MetaData for the QueryMessage- Returns:
- a copy of this message with the given MetaData
-
andMetaData
Description copied from interface:QueryMessageReturns a copy of this QueryMessage with its MetaData merged with givenmetaData. The payload remains unchanged.- Specified by:
andMetaDatain interfaceMessage<T>- Specified by:
andMetaDatain interfaceQueryMessage<T,R> - Parameters:
metaData- The MetaData to merge into the QueryMessage- Returns:
- a copy of this message with the given additional MetaData
-
describeTo
Description copied from class:MessageDecoratorDescribe the message specific properties to the givenstringBuilder. Subclasses should override this method, calling the super method and appending their own properties to the end (or beginning).As convention, String values should be enclosed in single quotes, Objects in curly brackets and numeric values may be appended without enclosing. All properties should be preceded by a comma when appending, or finish with a comma when prefixing values.
- Overrides:
describeToin classMessageDecorator<T>- Parameters:
stringBuilder- the builder to append data to
-
describeType
Description copied from class:MessageDecoratorDescribe the type of message, used inMessageDecorator.toString().Defaults to the simple class name of the actual instance.
- Overrides:
describeTypein classMessageDecorator<T>- Returns:
- the type of message
-