public class KafkaMetadataUtil extends Object
KafkaMessageMetadata
in a Message
.Constructor and Description |
---|
KafkaMetadataUtil() |
Modifier and Type | Method and Description |
---|---|
static Optional<IncomingKafkaRecordMetadata> |
readIncomingKafkaMetadata(Message<?> msg)
Read
IncomingKafkaRecordMetadata from a Message . |
static <T,K> Message<T> |
writeOutgoingKafkaMetadata(Message<T> msg,
OutgoingKafkaRecordMetadata<K> outgoingKafkaRecordMetadata)
Write
OutgoingKafkaRecordMetadata to a Message . |
public static Optional<IncomingKafkaRecordMetadata> readIncomingKafkaMetadata(Message<?> msg)
IncomingKafkaRecordMetadata
from a Message
.msg
- the message. Must not be null
IncomingKafkaRecordMetadata
. May return null
, for example if the message is
not received from a channel backed by KafkaNullPointerException
- if msg
is null
public static <T,K> Message<T> writeOutgoingKafkaMetadata(Message<T> msg, OutgoingKafkaRecordMetadata<K> outgoingKafkaRecordMetadata)
OutgoingKafkaRecordMetadata
to a Message
. Note that Message
is immutable,
so the passed in parameter will not have the OutgoingKafkaRecordMetadata
added. This
method returns a new instance of Message
with the OutgoingKafkaRecordMetadata
added.msg
- the message. Must not be null
outgoingKafkaRecordMetadata
- the OutgoingKafkaRecordMetadata
to write. Must not be null
OutgoingKafkaRecordMetadata
addedNullPointerException
- if msg
or outgoingKafkaRecordMetadata
are null
Copyright © 2018–2021 SmallRye. All rights reserved.