Package org.axonframework.messaging.core
Interface ResultMessage
- All Superinterfaces:
Message
- All Known Subinterfaces:
CommandResultMessage,QueryResponseMessage,SubscriptionQueryUpdateMessage
- All Known Implementing Classes:
GenericCommandResultMessage,GenericQueryResponseMessage,GenericResultMessage,GenericSubscriptionQueryUpdateMessage
A
Message that represents a result of handling some form of a request message.- Since:
- 4.0.0
- Author:
- Milan Savic
-
Field Summary
Fields inherited from interface org.axonframework.messaging.core.Message
RESOURCE_KEY -
Method Summary
Modifier and TypeMethodDescriptionandMetadata(Map<String, String> metadata) default ResultMessagewithConvertedPayload(Class<?> type, Converter converter) Returns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.withConvertedPayload(Type type, Converter converter) Returns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.default ResultMessagewithConvertedPayload(TypeReference<?> 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.
-
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- 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- Parameters:
metadata- The metadata to merge with.- Returns:
- A copy of
this Message (implementation)with the givenmetadata.
-
withConvertedPayload
@Nonnull default ResultMessage withConvertedPayload(@Nonnull Class<?> type, @Nonnull Converter converter) 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- 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.
-
withConvertedPayload
@Nonnull default ResultMessage withConvertedPayload(@Nonnull TypeReference<?> type, @Nonnull Converter converter) 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- 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.
-
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- 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.
-