Class ProjectingMessageConverter
- java.lang.Object
-
- org.springframework.kafka.support.converter.MessagingMessageConverter
-
- org.springframework.kafka.support.converter.ProjectingMessageConverter
-
- All Implemented Interfaces:
MessageConverter
,RecordMessageConverter
public class ProjectingMessageConverter extends MessagingMessageConverter
AMessageConverter
implementation that uses a Spring DataProjectionFactory
to bind incoming messages to projection interfaces.- Since:
- 2.1.1
- Author:
- Oliver Gierke, Artem Bilan, Gary Russell
-
-
Field Summary
-
Fields inherited from class org.springframework.kafka.support.converter.MessagingMessageConverter
logger
-
-
Constructor Summary
Constructors Constructor Description ProjectingMessageConverter()
Create a newProjectingMessageConverter
using aJacksonUtils.enhancedObjectMapper()
by default.ProjectingMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper)
Create a newProjectingMessageConverter
using the givenObjectMapper
.ProjectingMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, MessagingMessageConverter delegate)
Create a newProjectingMessageConverter
using the givenObjectMapper
.ProjectingMessageConverter(MessagingMessageConverter delegate)
Create a newProjectingMessageConverter
using the givenObjectMapper
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
convertPayload(org.springframework.messaging.Message<?> message)
Subclasses can convert the payload; by default, it's sent unchanged to Kafka.protected java.lang.Object
extractAndConvertValue(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, java.lang.reflect.Type type)
Subclasses can convert the value; by default, it's returned as provided by Kafka unless there is aSmartMessageConverter
that can convert it.-
Methods inherited from class org.springframework.kafka.support.converter.MessagingMessageConverter
fromMessage, getMessagingConverter, initialRecordHeaders, setGenerateMessageId, setGenerateTimestamp, setHeaderMapper, setMessagingConverter, setRawRecordHeader, toMessage
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.kafka.support.converter.MessageConverter
commonHeaders
-
-
-
-
Constructor Detail
-
ProjectingMessageConverter
public ProjectingMessageConverter()
Create a newProjectingMessageConverter
using aJacksonUtils.enhancedObjectMapper()
by default.- Since:
- 2.3
-
ProjectingMessageConverter
public ProjectingMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper)
Create a newProjectingMessageConverter
using the givenObjectMapper
.- Parameters:
mapper
- must not be null.
-
ProjectingMessageConverter
public ProjectingMessageConverter(MessagingMessageConverter delegate)
Create a newProjectingMessageConverter
using the givenObjectMapper
.- Parameters:
delegate
- the delegate converter for outbound and non-interfaces.- Since:
- 2.3
-
ProjectingMessageConverter
public ProjectingMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, MessagingMessageConverter delegate)
Create a newProjectingMessageConverter
using the givenObjectMapper
.- Parameters:
mapper
- must not be null.delegate
- the delegate converter for outbound and non-interfaces.- Since:
- 2.3
-
-
Method Detail
-
convertPayload
protected java.lang.Object convertPayload(org.springframework.messaging.Message<?> message)
Description copied from class:MessagingMessageConverter
Subclasses can convert the payload; by default, it's sent unchanged to Kafka.- Overrides:
convertPayload
in classMessagingMessageConverter
- Parameters:
message
- the message.- Returns:
- the payload.
-
extractAndConvertValue
protected java.lang.Object extractAndConvertValue(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> record, java.lang.reflect.Type type)
Description copied from class:MessagingMessageConverter
Subclasses can convert the value; by default, it's returned as provided by Kafka unless there is aSmartMessageConverter
that can convert it.- Overrides:
extractAndConvertValue
in classMessagingMessageConverter
- Parameters:
record
- the record.type
- the required type.- Returns:
- the value.
-
-