public class OutgoingKafkaRecord<K,T> extends Object implements KafkaRecord<K,T>
| Constructor and Description |
|---|
OutgoingKafkaRecord(String topic,
K key,
T value,
Instant timestamp,
int partition,
org.apache.kafka.common.header.Headers headers,
Supplier<CompletionStage<Void>> ack,
Function<Throwable,CompletionStage<Void>> nack,
Metadata existingMetadata) |
| Modifier and Type | Method and Description |
|---|---|
CompletionStage<Void> |
ack()
Acknowledge this message.
|
static <K,T> OutgoingKafkaRecord<K,T> |
from(Message<T> message) |
Supplier<CompletionStage<Void>> |
getAck() |
org.apache.kafka.common.header.Headers |
getHeaders() |
K |
getKey() |
Metadata |
getMetadata() |
Function<Throwable,CompletionStage<Void>> |
getNack() |
int |
getPartition() |
T |
getPayload() |
Instant |
getTimestamp() |
String |
getTopic() |
OutgoingKafkaRecord<K,T> |
with(String topic,
K key,
T value) |
OutgoingKafkaRecord<K,T> |
with(String topic,
K key,
T value,
Instant timestamp,
int partition) |
OutgoingKafkaRecord<K,T> |
with(String topic,
T value) |
OutgoingKafkaRecord<K,T> |
withAck(Supplier<CompletionStage<Void>> supplier)
Creates a new instance of
Message with the given acknowledgement supplier. |
OutgoingKafkaRecord<K,T> |
withHeader(String key,
byte[] content)
Creates a new outgoing Kafka Message with a header added to the header list.
|
OutgoingKafkaRecord<K,T> |
withHeader(String key,
String content)
Creates a new outgoing Kafka Message with a header added to the header list.
|
OutgoingKafkaRecord<K,T> |
withHeader(String key,
String content,
Charset enc)
Creates a new outgoing Kafka Message with a header added to the header list.
|
OutgoingKafkaRecord<K,T> |
withMetadata(Iterable<Object> metadata)
Creates a new instance of
Message with the specified metadata. |
OutgoingKafkaRecord<K,T> |
withMetadata(Metadata metadata)
Creates a new instance of
Message with the specified metadata. |
OutgoingKafkaRecord<K,T> |
withNack(Function<Throwable,CompletionStage<Void>> nack)
Creates a new instance of
Message with the given negative-acknowledgement function. |
<P> OutgoingKafkaRecord<K,P> |
withPayload(P payload)
Creates a new instance of
Message with the specified payload. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitof, of, ofaddMetadata, getMetadata, nack, nack, of, of, of, unwrappublic static <K,T> OutgoingKafkaRecord<K,T> from(Message<T> message)
from in interface KafkaRecord<K,T>public CompletionStage<Void> ack()
Messagepublic T getPayload()
getPayload in interface Message<T>public K getKey()
getKey in interface KafkaRecord<K,T>public String getTopic()
getTopic in interface KafkaRecord<K,T>public Instant getTimestamp()
getTimestamp in interface KafkaRecord<K,T>public org.apache.kafka.common.header.Headers getHeaders()
getHeaders in interface KafkaRecord<K,T>public Supplier<CompletionStage<Void>> getAck()
getAck in interface Message<T>CompletionStage.public Function<Throwable,CompletionStage<Void>> getNack()
public int getPartition()
getPartition in interface KafkaRecord<K,T>public Metadata getMetadata()
getMetadata in interface Message<T>public OutgoingKafkaRecord<K,T> withHeader(String key, byte[] content)
key - the header keycontent - the header key, must not be nullpublic OutgoingKafkaRecord<K,T> withHeader(String key, String content)
key - the header keycontent - the header key, must not be nullpublic OutgoingKafkaRecord<K,T> withHeader(String key, String content, Charset enc)
key - the header keycontent - the header key, must not be nullenc - the encoding, must not be nullpublic OutgoingKafkaRecord<K,T> with(String topic, T value)
public OutgoingKafkaRecord<K,T> with(String topic, K key, T value, Instant timestamp, int partition)
public <P> OutgoingKafkaRecord<K,P> withPayload(P payload)
MessageMessage with the specified payload.
The metadata and ack/nack functions are taken from the current Message.withPayload in interface Message<T>P - the type of the new payloadpayload - the new payload.Messagepublic OutgoingKafkaRecord<K,T> withMetadata(Iterable<Object> metadata)
MessageMessage with the specified metadata.
The payload and ack/nack functions are taken from the current Message.withMetadata in interface Message<T>metadata - the metadata, must not be null, must not contains null.Messagepublic OutgoingKafkaRecord<K,T> withMetadata(Metadata metadata)
MessageMessage with the specified metadata.
The payload and ack/nack functions are taken from the current Message.withMetadata in interface Message<T>metadata - the metadata, must not be null.Messagepublic OutgoingKafkaRecord<K,T> withAck(Supplier<CompletionStage<Void>> supplier)
Messagepublic OutgoingKafkaRecord<K,T> withNack(Function<Throwable,CompletionStage<Void>> nack)
MessageCopyright © 2018–2021 SmallRye. All rights reserved.