Interface BatchMessageConverter
- All Superinterfaces:
MessageConverter
- All Known Implementing Classes:
BatchMessagingMessageConverter
A Kafka-specific
Message
converter strategy.- Since:
- 1.1
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.kafka.clients.producer.ProducerRecord<?,
?>> fromMessage
(Message<?> message, String defaultTopic) Convert a message to a producer record.default RecordMessageConverter
Return the record converter used by this batch converter, if configured, or null.Message<?>
toMessage
(List<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>> records, Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Type payloadType) Convert a list ofConsumerRecord
to aMessage
.Methods inherited from interface org.springframework.kafka.support.converter.MessageConverter
commonHeaders
-
Method Details
-
toMessage
@NonNull Message<?> toMessage(List<org.apache.kafka.clients.consumer.ConsumerRecord<?, ?>> records, @Nullable Acknowledgment acknowledgment, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Type payloadType) Convert a list ofConsumerRecord
to aMessage
.- Parameters:
records
- the records.acknowledgment
- the acknowledgment.consumer
- the consumer.payloadType
- the required payload type.- Returns:
- the message.
-
fromMessage
List<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 records.
-
getRecordMessageConverter
Return the record converter used by this batch converter, if configured, or null.- Returns:
- the converter or null.
- Since:
- 2.1.5
-