Class OutgoingKafkaRecord<K,T>
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.OutgoingKafkaRecord<K,T>
-
- All Implemented Interfaces:
KafkaRecord<K,T>,ContextAwareMessage<T>,org.eclipse.microprofile.reactive.messaging.Message<T>
public class OutgoingKafkaRecord<K,T> extends Object implements KafkaRecord<K,T>
-
-
Constructor Summary
Constructors Constructor 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, org.eclipse.microprofile.reactive.messaging.Metadata existingMetadata)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>ack()static <K,T>
OutgoingKafkaRecord<K,T>from(org.eclipse.microprofile.reactive.messaging.Message<T> message)Supplier<CompletionStage<Void>>getAck()org.apache.kafka.common.header.HeadersgetHeaders()KgetKey()org.eclipse.microprofile.reactive.messaging.MetadatagetMetadata()Function<Throwable,CompletionStage<Void>>getNack()intgetPartition()TgetPayload()InstantgetTimestamp()StringgetTopic()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)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)OutgoingKafkaRecord<K,T>withMetadata(org.eclipse.microprofile.reactive.messaging.Metadata metadata)OutgoingKafkaRecord<K,T>withNack(Function<Throwable,CompletionStage<Void>> nack)<P> OutgoingKafkaRecord<K,P>withPayload(P payload)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.smallrye.reactive.messaging.providers.locals.ContextAwareMessage
getContextMetadata
-
-
-
-
Constructor Detail
-
OutgoingKafkaRecord
public 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, org.eclipse.microprofile.reactive.messaging.Metadata existingMetadata)
-
-
Method Detail
-
from
public static <K,T> OutgoingKafkaRecord<K,T> from(org.eclipse.microprofile.reactive.messaging.Message<T> message)
-
ack
public CompletionStage<Void> ack()
- Specified by:
ackin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
getPayload
public T getPayload()
- Specified by:
getPayloadin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
getKey
public K getKey()
- Specified by:
getKeyin interfaceKafkaRecord<K,T>
-
getTopic
public String getTopic()
- Specified by:
getTopicin interfaceKafkaRecord<K,T>
-
getTimestamp
public Instant getTimestamp()
- Specified by:
getTimestampin interfaceKafkaRecord<K,T>
-
getHeaders
public org.apache.kafka.common.header.Headers getHeaders()
- Specified by:
getHeadersin interfaceKafkaRecord<K,T>
-
getAck
public Supplier<CompletionStage<Void>> getAck()
- Specified by:
getAckin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
getNack
public Function<Throwable,CompletionStage<Void>> getNack()
- Specified by:
getNackin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
getPartition
public int getPartition()
- Specified by:
getPartitionin interfaceKafkaRecord<K,T>
-
getMetadata
public org.eclipse.microprofile.reactive.messaging.Metadata getMetadata()
- Specified by:
getMetadatain interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
withHeader
public OutgoingKafkaRecord<K,T> withHeader(String key, byte[] content)
Creates a new outgoing Kafka Message with a header added to the header list.- Parameters:
key- the header keycontent- the header key, must not benull- Returns:
- the updated Kafka Message.
-
withHeader
public OutgoingKafkaRecord<K,T> withHeader(String key, String content)
Creates a new outgoing Kafka Message with a header added to the header list.- Parameters:
key- the header keycontent- the header key, must not benull- Returns:
- the updated Kafka Message.
-
withHeader
public OutgoingKafkaRecord<K,T> withHeader(String key, String content, Charset enc)
Creates a new outgoing Kafka Message with a header added to the header list.- Parameters:
key- the header keycontent- the header key, must not benullenc- the encoding, must not benull- Returns:
- the updated Kafka Message.
-
with
public OutgoingKafkaRecord<K,T> with(String topic, T value)
-
with
public OutgoingKafkaRecord<K,T> with(String topic, K key, T value, Instant timestamp, int partition)
-
withPayload
public <P> OutgoingKafkaRecord<K,P> withPayload(P payload)
- Specified by:
withPayloadin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
withMetadata
public OutgoingKafkaRecord<K,T> withMetadata(Iterable<Object> metadata)
- Specified by:
withMetadatain interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
withMetadata
public OutgoingKafkaRecord<K,T> withMetadata(org.eclipse.microprofile.reactive.messaging.Metadata metadata)
- Specified by:
withMetadatain interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
withAck
public OutgoingKafkaRecord<K,T> withAck(Supplier<CompletionStage<Void>> supplier)
- Specified by:
withAckin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
withNack
public OutgoingKafkaRecord<K,T> withNack(Function<Throwable,CompletionStage<Void>> nack)
- Specified by:
withNackin interfaceorg.eclipse.microprofile.reactive.messaging.Message<K>
-
-