Class AbstractMessagingMessageConverter<S>
java.lang.Object
io.awspring.cloud.sqs.support.converter.AbstractMessagingMessageConverter<S>
- All Implemented Interfaces:
ContextAwareMessagingMessageConverter<S>,MessagingMessageConverter<S>
- Direct Known Subclasses:
SqsMessagingMessageConverter
public abstract class AbstractMessagingMessageConverter<S>
extends Object
implements ContextAwareMessagingMessageConverter<S>
Base
MessagingMessageConverter implementation.- Since:
- 3.0
- Author:
- Tomaz Fernandes
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract HeaderMapper<S>An optional context to be used in the conversion process.protected abstract SdoConvertMessage(S messageWithHeaders, Object payload) fromMessagingMessage(Message<?> message, MessageConversionContext context) Convert aMessageto a message from a specific messaging system.Get theMessageConverterto be used for converting theMessageinstances payloads.protected abstract ObjectgetPayloadToDeserialize(S message) voidsetHeaderMapper(HeaderMapper<S> headerMapper) Set theHeaderMapperto used to convert headers forMessageinstances.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Set theObjectMapperinstance to be used for converting theMessageinstances payloads.voidsetPayloadMessageConverter(MessageConverter messageConverter) Set theMessageConverterto be used for converting theMessageinstances payloads.voidsetPayloadTypeHeader(String typeHeader) Set the name of the header to be looked up in aMessageinstance by thedefaultHeaderTypeMapping(Message).voidsetPayloadTypeHeaderValueFunction(Function<Message<?>, String> payloadTypeHeaderFunction) Set the function to create the payload type header value from.voidsetPayloadTypeMapper(Function<Message<?>, Class<?>> payloadTypeMapper) Set the payload type mapper to be used by this converter.Message<?>toMessagingMessage(S message, MessageConversionContext context) Convert a source message from a specific messaging system to aMessagewith an optional context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.awspring.cloud.sqs.support.converter.ContextAwareMessagingMessageConverter
fromMessagingMessage, toMessagingMessage
-
Constructor Details
-
AbstractMessagingMessageConverter
protected AbstractMessagingMessageConverter()
-
-
Method Details
-
setPayloadTypeMapper
Set the payload type mapper to be used by this converter.Messagepayloads will be converted to theClassreturned by this function. ThedefaultHeaderTypeMapping(org.springframework.messaging.Message<?>)uses thetypeHeaderproperty to retrieve the payload class' FQCN. This method replaces the default type mapping for this converter instance.- Parameters:
payloadTypeMapper- the type mapping function.
-
setPayloadMessageConverter
Set theMessageConverterto be used for converting theMessageinstances payloads.- Parameters:
messageConverter- the converter instance.
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Set theObjectMapperinstance to be used for converting theMessageinstances payloads.- Parameters:
objectMapper- the object mapper instance.
-
getPayloadMessageConverter
Get theMessageConverterto be used for converting theMessageinstances payloads.- Returns:
- the instance.
-
setPayloadTypeHeader
Set the name of the header to be looked up in aMessageinstance by thedefaultHeaderTypeMapping(Message).- Parameters:
typeHeader- the header name.
-
setPayloadTypeHeaderValueFunction
public void setPayloadTypeHeaderValueFunction(Function<Message<?>, String> payloadTypeHeaderFunction) Set the function to create the payload type header value from.- Parameters:
payloadTypeHeaderFunction- the function.
-
setHeaderMapper
Set theHeaderMapperto used to convert headers forMessageinstances.- Parameters:
headerMapper- the header mapper instance.
-
createDefaultHeaderMapper
-
toMessagingMessage
Description copied from interface:ContextAwareMessagingMessageConverterConvert a source message from a specific messaging system to aMessagewith an optional context.- Specified by:
toMessagingMessagein interfaceContextAwareMessagingMessageConverter<S>- Parameters:
message- the source message.context- an optional context with information to be used in the conversion process.- Returns:
- the converted message.
-
getPayloadToDeserialize
-
createMessageConversionContext
Description copied from interface:ContextAwareMessagingMessageConverterAn optional context to be used in the conversion process.- Specified by:
createMessageConversionContextin interfaceContextAwareMessagingMessageConverter<S>- Returns:
- the context.
-
fromMessagingMessage
Description copied from interface:ContextAwareMessagingMessageConverterConvert aMessageto a message from a specific messaging system.- Specified by:
fromMessagingMessagein interfaceContextAwareMessagingMessageConverter<S>- Parameters:
message- the message from which to convert.context- an optional context with information to be used in the conversion process.- Returns:
- the system specific message.
-
doConvertMessage
-