Class IncomingKafkaRecord<K,T>
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.IncomingKafkaRecord<K,T>
-
- All Implemented Interfaces:
KafkaRecord<K,T>,Message<T>
public class IncomingKafkaRecord<K,T> extends Object implements KafkaRecord<K,T>
-
-
Constructor Summary
Constructors Constructor Description IncomingKafkaRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,T> record, KafkaCommitHandler commitHandler, KafkaFailureHandler onNack, boolean cloudEventEnabled, boolean tracingEnabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>ack()Acknowledge this message.Supplier<CompletionStage<Void>>getAck()org.apache.kafka.common.header.HeadersgetHeaders()KgetKey()MetadatagetMetadata()Function<Throwable,CompletionStage<Void>>getNack()longgetOffset()intgetPartition()TgetPayload()InstantgetTimestamp()StringgetTopic()voidinjectTracingMetadata(TracingMetadata tracingMetadata)CompletionStage<Void>nack(Throwable reason, Metadata metadata)Acknowledge negatively this message.-
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, withAck, withMetadata, withMetadata, withNack, withPayload
-
-
-
-
Constructor Detail
-
IncomingKafkaRecord
public IncomingKafkaRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,T> record, KafkaCommitHandler commitHandler, KafkaFailureHandler onNack, boolean cloudEventEnabled, boolean tracingEnabled)
-
-
Method Detail
-
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>
-
getPartition
public int getPartition()
- Specified by:
getPartitionin 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>
-
getOffset
public long getOffset()
-
getMetadata
public Metadata getMetadata()
- Specified by:
getMetadatain interfaceMessage<K>- Returns:
- The set of metadata attached to this message, potentially empty.
-
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()
-
ack
public CompletionStage<Void> ack()
Description copied from interface:MessageAcknowledge this message.
-
nack
public CompletionStage<Void> nack(Throwable reason, Metadata metadata)
Description copied from interface:MessageAcknowledge negatively this message.nackis used to indicate that the processing of a message failed. The reason is passed as parameter. Additional metadata may be provided that the connector can use when nacking the message. The interpretation of metadata is connector-specific.- Specified by:
nackin interfaceMessage<K>- Parameters:
reason- the reason of the nack, must not benullmetadata- additional nack metadata the connector may use, may benull- Returns:
- a completion stage completed when the message is negative-acknowledgement has completed. If the negative acknowledgement fails, the completion stage propagates the failure.
-
injectTracingMetadata
public void injectTracingMetadata(TracingMetadata tracingMetadata)
-
-