Interface RecordMessageConverter
- All Superinterfaces:
MessageConverter
- All Known Implementing Classes:
ByteArrayJsonMessageConverter
,BytesJsonMessageConverter
,JsonMessageConverter
,MessagingMessageConverter
,ProjectingMessageConverter
,StringJsonMessageConverter
A Kafka-specific
Message
converter strategy.- Since:
- 1.1
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kafka.clients.producer.ProducerRecord<?,
?> fromMessage
(Message<?> message, String defaultTopic) Convert a message to a producer record.Message<?>
toMessage
(org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Type payloadType) Convert aConsumerRecord
to aMessage
.Methods inherited from interface org.springframework.kafka.support.converter.MessageConverter
commonHeaders
-
Method Details
-
toMessage
@NonNull Message<?> toMessage(org.apache.kafka.clients.consumer.ConsumerRecord<?, ?> record, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Type payloadType) Convert aConsumerRecord
to aMessage
.- Parameters:
record
- the record.acknowledgment
- the acknowledgment.consumer
- the consumerpayloadType
- the required payload type.- Returns:
- the message.
-
fromMessage
org.apache.kafka.clients.producer.ProducerRecord<?,?> fromMessage(Message<?> message, String defaultTopic) Convert a message to a producer record.- Parameters:
message
- the message.defaultTopic
- the default topic to use if no header found.- Returns:
- the producer record.
-