Class JacksonProjectingMessageConverter
java.lang.Object
org.springframework.kafka.support.converter.MessagingMessageConverter
org.springframework.kafka.support.converter.JacksonProjectingMessageConverter
- All Implemented Interfaces:
MessageConverter, RecordMessageConverter
A
MessageConverter implementation based on Jackson3 uses a Spring Data
ProjectionFactory to bind incoming messages to projection interfaces.- Since:
- 4.0
-
Field Summary
Fields inherited from class MessagingMessageConverter
logger -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newJacksonProjectingMessageConverterusing aJacksonMapperUtils.enhancedJsonMapper()by default.Create a newJacksonProjectingMessageConverterusing the givenJsonMapper.JacksonProjectingMessageConverter(tools.jackson.databind.json.JsonMapper mapper) Create a newJacksonProjectingMessageConverterusing the givenJsonMapper.JacksonProjectingMessageConverter(tools.jackson.databind.json.JsonMapper mapper, MessagingMessageConverter delegate) Create a newJacksonProjectingMessageConverterusing the givenJsonMapper. -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable ObjectconvertPayload(org.springframework.messaging.Message<?> message) Subclasses can convert the payload; by default, it's sent unchanged to Kafka.protected ObjectextractAndConvertValue(org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record, @Nullable Type type) Subclasses can convert the value; by default, it's returned as provided by Kafka unless there is aSmartMessageConverterthat can convert it.Methods inherited from class MessagingMessageConverter
fromMessage, getMessagingConverter, initialRecordHeaders, setGenerateMessageId, setGenerateTimestamp, setHeaderMapper, setMessagingConverter, setRawRecordHeader, toMessageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MessageConverter
commonHeaders
-
Constructor Details
-
JacksonProjectingMessageConverter
public JacksonProjectingMessageConverter()Create a newJacksonProjectingMessageConverterusing aJacksonMapperUtils.enhancedJsonMapper()by default. -
JacksonProjectingMessageConverter
public JacksonProjectingMessageConverter(tools.jackson.databind.json.JsonMapper mapper) Create a newJacksonProjectingMessageConverterusing the givenJsonMapper.- Parameters:
mapper- must not be null.
-
JacksonProjectingMessageConverter
Create a newJacksonProjectingMessageConverterusing the givenJsonMapper.- Parameters:
delegate- the delegate converter for outbound and non-interfaces.
-
JacksonProjectingMessageConverter
public JacksonProjectingMessageConverter(tools.jackson.databind.json.JsonMapper mapper, MessagingMessageConverter delegate) Create a newJacksonProjectingMessageConverterusing the givenJsonMapper.- Parameters:
mapper- must not be null.delegate- the delegate converter for outbound and non-interfaces.
-
-
Method Details
-
convertPayload
Description copied from class:MessagingMessageConverterSubclasses can convert the payload; by default, it's sent unchanged to Kafka.- Overrides:
convertPayloadin classMessagingMessageConverter- Parameters:
message- the message.- Returns:
- the payload.
-
extractAndConvertValue
protected Object extractAndConvertValue(org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record, @Nullable Type type) Description copied from class:MessagingMessageConverterSubclasses can convert the value; by default, it's returned as provided by Kafka unless there is aSmartMessageConverterthat can convert it.- Overrides:
extractAndConvertValuein classMessagingMessageConverter- Parameters:
record- the record.type- the required type.- Returns:
- the value.
-