Class Record<K,V>
java.lang.Object
io.smallrye.reactive.messaging.kafka.Record<K,V>
- Type Parameters:
K- the type of the keyV- the type of the value
Represents a produced Kafka record, so a pair {key, value}.
This class is used by application willing to configure the written record. The couple key/value is used for, respectively, the record's key and record's value. Instances are used as message's payload.
Both key and value can be null. Instances of this class are immutable.
If the application needs to configure more aspect of the record, use the
OutgoingCloudEventMetadata.
If the attached metadata configures the key, the key provided by the record is overidden.
-
Method Summary
Modifier and TypeMethodDescriptionkey()static <K,V> Record<K, V> of(K key, V value) Creates a new record.value()withKey(T key) Creates a new instance ofRecordwith given key and the value from the current record.withValue(T value) Creates a new instance ofRecordwith the key from the current record and the new value.
-
Method Details
-
of
Creates a new record.- Type Parameters:
K- the type of the keyV- the type of the value- Parameters:
key- the key, can benullvalue- the value, can benull
-
key
- Returns:
- the key, may be
null
-
value
- Returns:
- the value, may be
null
-
withKey
Creates a new instance ofRecordwith given key and the value from the current record.- Type Parameters:
T- the type of the new key- Parameters:
key- the new key, can benull- Returns:
- the new record
-
withValue
Creates a new instance ofRecordwith the key from the current record and the new value.- Type Parameters:
T- the type of the new value- Parameters:
value- the new value, can benull- Returns:
- the new record
-