Interface KafkaMessage<K,V>
- Type Parameters:
K- the type of Kafka record keyV- the type of Kafka record value
- All Superinterfaces:
Message<V>
- All Known Implementing Classes:
KafkaProducerMessage
Kafka specific Micro Profile Reactive Messaging Message.
-
Method Summary
Modifier and TypeMethodDescriptionReturnsConsumerRecordif message was received from Kafka, otherwise returnOptional.empty().org.apache.kafka.common.header.HeadersReturnsHeadersreceived from Kafka with record or empty headers if message was not created by Kafka connector.getKey()Key orOptional.empty()if non is specified.Offset of the record in partition from which was this message received.Number of partition from which was this message received.getTopic()Name of the topic from which was this message received.static <K,V> KafkaMessage <K, V> of(K key, V payload) Create a message with the given payload and ack function.static <K,V> KafkaMessage <K, V> of(K key, V payload, Supplier<CompletionStage<Void>> ack) Create a message with the given payload and ack function.static <K,V> KafkaMessage <K, V> of(V payload) Create a message with the given payload and ack function.static <K,V> KafkaMessage <K, V> of(V payload, Supplier<CompletionStage<Void>> ack) Create a message with the given payload and ack function.Methods inherited from interface org.eclipse.microprofile.reactive.messaging.Message
ack, getAck, getNack, getPayload, nack, unwrap, withAck, withNack, withPayload
-
Method Details
-
getTopic
Name of the topic from which was this message received.- Returns:
- topic name
-
getPartition
Number of partition from which was this message received.- Returns:
- partition number
-
getOffset
Offset of the record in partition from which was this message received.- Returns:
- offset number
-
getConsumerRecord
ReturnsConsumerRecordif message was received from Kafka, otherwise returnOptional.empty().- Returns:
ConsumerRecordorOptional.empty()
-
getKey
Key orOptional.empty()if non is specified.- Returns:
- Key or
Optional.empty()
-
getHeaders
org.apache.kafka.common.header.Headers getHeaders()ReturnsHeadersreceived from Kafka with record or empty headers if message was not created by Kafka connector.- Returns:
Headersreceived from Kafka or empty headers if message was not created by Kafka connector
-
of
Create a message with the given payload and ack function.- Type Parameters:
K- the type of Kafka record keyV- the type of Kafka record value- Parameters:
key- Kafka record keypayload- Kafka record valueack- The ack function, this will be invoked when the returned messagesMessage.ack()method is invoked- Returns:
- A message with the given payload and ack function
-
of
Create a message with the given payload and ack function.- Type Parameters:
K- the type of Kafka record keyV- the type of Kafka record value- Parameters:
payload- Kafka record valueack- The ack function, this will be invoked when the returned messagesMessage.ack()method is invoked- Returns:
- A message with the given payload and ack function
-
of
Create a message with the given payload and ack function.- Type Parameters:
K- the type of Kafka record keyV- the type of Kafka record value- Parameters:
key- Kafka record keypayload- Kafka record value- Returns:
- A message with the given payload and ack function
-
of
Create a message with the given payload and ack function.- Type Parameters:
K- the type of Kafka record keyV- the type of Kafka record value- Parameters:
payload- Kafka record value- Returns:
- A message with the given payload and ack function
-