Class ConverterProperties
Converters used for different types of objects that Axon needs to
convert.
The general Converter forms the baseline and is used to convert all objects that do not fall into more
specific categories. Typical examples include snapshots and other internal data that is not expected to be shared
with other systems. If no general Converter is specified, Axon defaults to the
JacksonConverter.
The messages Converter, if specified, takes precedence over the general converter for all
Messages and, where relevant, their return values. This includes
commands, queries, and events, as well as
CommandResultMessages and
QueryResponseMessages. To ensure the messages
Converter only applies to messages, it is wrapped in a
DelegatingMessageConverter. When no message
Converter is specified, it defaults back to the general converter.
The events Converter, if specified, takes precedence over both the messages and general converters,
but applies only to the EventMessages stored in the event
store and published on the event bus. To ensure it only applies to event messages, it is wrapped in a
DelegatingEventConverter. When no event
Converter is specified, it defaults back to the messages converter.
- Since:
- 3.2.0
- Author:
- Allard Buijze, Steven van Beelen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates different possible standardConvertersavailable in Axon Framework. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe type ofConverterto use to convert any type for which no more specificConverteris configured.voidsetEvents(ConverterProperties.ConverterType converterType) voidsetGeneral(ConverterProperties.ConverterType converterType) Sets the type ofConverterto use to convert any type for which no more specificConverteris configured.voidsetMessages(ConverterProperties.ConverterType converterType)
-
Constructor Details
-
ConverterProperties
public ConverterProperties()
-
-
Method Details
-
getGeneral
The type ofConverterto use to convert any type for which no more specificConverteris configured.Defaults to the
default ConverterType.- Returns:
- The
Convertertype to use for conversion of all kinds of objects
-
setGeneral
Sets the type ofConverterto use to convert any type for which no more specificConverteris configured.Defaults to the
default ConverterType.- Parameters:
converterType- The converter type to use for converting any object.
-
getMessages
The type ofConverterto use to convert theMessage.payload()of any type ofMessage.The constructed
Converterwill always be wrapped in aDelegatingMessageConverter, ensuring theConverteronly deals withMessages.Defaults to the
general Converter.- Returns:
- The type of
Converterto use forMessage payloads.
-
setMessages
Sets the type ofConverterto use to convert theMessage.payload()of any type ofMessage.The constructed
Converterwill always be wrapped in aDelegatingMessageConverter, ensuring theConverteronly deals withMessages.Defaults to the general
Converter.- Parameters:
converterType- The converter type to use for converting anyMessageMessage.payload().
-
getEvents
The type ofConverterto use to convert theMessage.payload()ofEventMessages.The constructed
Converterwill always be wrapped in aDelegatingEventConverter, ensuring theConverteronly deals withEventMessages.Defaults to the messages
Converterwhen set, or otherwise the generalConverter.- Returns:
- The type of
Converterto use forEventMessage payloads.
-
setEvents
Sets the type ofConverterto use to convert theMessage.payload()ofEventMessages.The constructed
Converterwill always be wrapped in aDelegatingEventConverter, ensuring theConverteronly deals withEventMessages.Defaults to the messages
Converterwhen set, or otherwise the generalConverter.- Parameters:
converterType- The converter type to use for converting anyEventMessageMessage.payload().
-