Class OutgoingKafkaRecord<K,T>
- java.lang.Object
 - 
- io.smallrye.reactive.messaging.kafka.OutgoingKafkaRecord<K,T>
 
 
- 
- All Implemented Interfaces:
 KafkaRecord<K,T>,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, Metadata existingMetadata) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.HeadersgetHeaders()KgetKey()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)Creates a new instance ofMessagewith 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 ofMessagewith the specified metadata.OutgoingKafkaRecord<K,T>withMetadata(Metadata metadata)Creates a new instance ofMessagewith the specified metadata.OutgoingKafkaRecord<K,T>withNack(Function<Throwable,CompletionStage<Void>> nack)Creates a new instance ofMessagewith the given negative-acknowledgement function.<P> OutgoingKafkaRecord<K,P>withPayload(P payload)Creates a new instance ofMessagewith the specified payload.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.eclipse.microprofile.reactive.messaging.Message
addMetadata, getMetadata, nack, unwrap 
 - 
 
 - 
 
- 
- 
Method Detail
- 
from
public static <K,T> OutgoingKafkaRecord<K,T> from(Message<T> message)
 
- 
ack
public CompletionStage<Void> ack()
Description copied from interface:MessageAcknowledge this message. 
- 
getPayload
public T getPayload()
- Specified by:
 getPayloadin interfaceMessage<K>- Returns:
 - The payload for this message.
 
 
- 
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 interfaceMessage<K>- Returns:
 - the supplier used to retrieve the acknowledgement 
CompletionStage. 
 
- 
getNack
public Function<Throwable,CompletionStage<Void>> getNack()
 
- 
getPartition
public int getPartition()
- Specified by:
 getPartitionin interfaceKafkaRecord<K,T>
 
- 
getMetadata
public Metadata getMetadata()
- Specified by:
 getMetadatain interfaceMessage<K>- Returns:
 - The set of metadata attached to this message, potentially empty.
 
 
- 
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)
Description copied from interface:MessageCreates a new instance ofMessagewith the specified payload. The metadata and ack/nack functions are taken from the currentMessage.- Specified by:
 withPayloadin interfaceMessage<K>- Type Parameters:
 P- the type of the new payload- Parameters:
 payload- the new payload.- Returns:
 - the new instance of 
Message 
 
- 
withMetadata
public OutgoingKafkaRecord<K,T> withMetadata(Iterable<Object> metadata)
Description copied from interface:MessageCreates a new instance ofMessagewith the specified metadata. The payload and ack/nack functions are taken from the currentMessage.- Specified by:
 withMetadatain interfaceMessage<K>- Parameters:
 metadata- the metadata, must not benull, must not containsnull.- Returns:
 - the new instance of 
Message 
 
- 
withMetadata
public OutgoingKafkaRecord<K,T> withMetadata(Metadata metadata)
Description copied from interface:MessageCreates a new instance ofMessagewith the specified metadata. The payload and ack/nack functions are taken from the currentMessage.- Specified by:
 withMetadatain interfaceMessage<K>- Parameters:
 metadata- the metadata, must not benull.- Returns:
 - the new instance of 
Message 
 
- 
withAck
public OutgoingKafkaRecord<K,T> withAck(Supplier<CompletionStage<Void>> supplier)
Description copied from interface:Message 
- 
withNack
public OutgoingKafkaRecord<K,T> withNack(Function<Throwable,CompletionStage<Void>> nack)
Description copied from interface:Message 
 - 
 
 -