Class GenericQueryMessage
- All Implemented Interfaces:
Message,QueryMessage
QueryMessage interface.- Since:
- 3.1.0
- Author:
- Marc Gathier, Steven van Beelen
-
Field Summary
Fields inherited from interface org.axonframework.messaging.core.Message
RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionGenericQueryMessage(Message delegate) Constructs aGenericQueryMessagewith givendelegateandresponseType.GenericQueryMessage(Message delegate, Integer priority) Constructs aGenericQueryMessagewith givendelegate,responseTypeandpriority.GenericQueryMessage(MessageType type, Object payload) -
Method Summary
Modifier and TypeMethodDescriptionandMetadata(Map<String, String> metadata) protected voiddescribeTo(StringBuilder stringBuilder) Describe the message specific properties to the givenstringBuilder.protected StringDescribe the type of message, used inMessageDecorator.toString().priority()Returns the priority of thisQueryMessage, if any is applicable.withConvertedPayload(Type type, Converter converter) Returns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.withMetadata(Map<String, String> metadata) Returns a copy of thisMessage(implementation) with the givenmetadata.Methods inherited from class org.axonframework.messaging.core.MessageDecorator
delegate, identifier, metadata, payload, payloadAs, payloadType, toString, typeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.messaging.core.Message
identifier, metadata, payload, payloadAs, payloadAs, payloadAs, payloadAs, payloadAs, payloadType, typeMethods inherited from interface org.axonframework.messaging.queryhandling.QueryMessage
withConvertedPayload, withConvertedPayload
-
Constructor Details
-
GenericQueryMessage
Constructs aGenericQueryMessagefor the giventype,payload, andresponseType.The
Metadatadefaults to an empty instance. Initializes the message with the givenpayloadand expectedresponseType.- Parameters:
type- Thetypefor thisQueryMessage.payload- The payload expressing the query for thisCommandMessage.
-
GenericQueryMessage
Constructs aGenericQueryMessagewith givendelegateandresponseType.The
delegatewill be used supply thepayload,type,metadataandidentifierof the resultingGenericQueryMessage.Unlike the other constructors, this constructor will not attempt to retrieve any correlation data from the Unit of Work.
- Parameters:
delegate- TheMessagecontainingpayload,type,identifierandmetadatafor theQueryMessageto reconstruct.- See Also:
-
GenericQueryMessage
Constructs aGenericQueryMessagewith givendelegate,responseTypeandpriority.The
delegatewill be used supply thepayload,type,metadataandidentifierof the resultingGenericQueryMessage.Unlike the other constructors, this constructor will not attempt to retrieve any correlation data from the Unit of Work.
- Parameters:
delegate- TheMessagecontainingpayload,type,identifierandmetadatafor theQueryMessageto reconstruct.priority- The priority of this query message. May benullto indicate no priority.
-
-
Method Details
-
withMetadata
Description copied from interface:MessageReturns a copy of thisMessage(implementation) with the givenmetadata.All other fields, like for example the
Message.payload(), remain unchanged.While the implementation returned may be different from the implementation of
this, implementations must take special care in returning the same type ofMessageto prevent errors further downstream.- Specified by:
withMetadatain interfaceMessage- Specified by:
withMetadatain interfaceQueryMessage- Parameters:
metadata- The new metadata for theMessage.- Returns:
- A copy of
this Message (implementation)with the givenmetadata.
-
andMetadata
Description copied from interface:MessageReturns a copy of thisMessage(implementation) with itsmetadatamerged with the givenmetadata.All other fields, like for example the
Message.payload(), remain unchanged.- Specified by:
andMetadatain interfaceMessage- Specified by:
andMetadatain interfaceQueryMessage- Parameters:
metadata- The metadata to merge with.- Returns:
- A copy of
this Message (implementation)with the givenmetadata.
-
withConvertedPayload
Description copied from interface:MessageReturns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter. This newMessageis effectively a copy ofthis Messagewith a renewed payload andMessage.payloadType().Will return the
thisinstance if thepayload typeisassignable fromthe converted result.- Specified by:
withConvertedPayloadin interfaceMessage- Specified by:
withConvertedPayloadin interfaceQueryMessage- Overrides:
withConvertedPayloadin classMessageDecorator- Parameters:
type- The type to convert theMessage.payload()to.converter- The converter to convert theMessage.payload()with.- Returns:
- A new
Messageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.
-
priority
Description copied from interface:QueryMessageReturns the priority of thisQueryMessage, if any is applicable.Queries with a higher priority should be handled before queries with a lower priority. Queries without a priority are considered to have the lowest priority.
- Specified by:
priorityin interfaceQueryMessage- Returns:
- The priority of this query message, or an empty
OptionalIntif no priority is set.
-
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- 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- Returns:
- The type of the message.
-