KafkaProducerRecord
public struct KafkaProducerRecord
The messages that can be sent by a KafkaProducer
.
-
Create a new
KafkaProducerRecord
with aString
value/keyDeclaration
Swift
public init(topic: String, value: Data, partition: Int? = nil, key: Data? = nil)
Parameters
topic
The topic where the record will be sent. If this topic doesn’t exist the producer will try to create it.
value
The message body that will be sent with the record.
partition
The topic partition the record will be sent to. If this is not set the partition will be automatically assigned.
key
If the partition is not set, records with the same key will be sent to the same partition. Since order is guaranteed within a partition, these records will be read in order they were produced.
-
Create a new
KafkaProducerRecord
with aData
value/keyDeclaration
Swift
public init(topic: String, value: String, partition: Int? = nil, key: String? = nil)
Parameters
topic
The topic where the record will be sent. If this topic doesn’t exist the producer will try to create it.
value
The message body that will be sent with the record.
partition
The topic partition the record will be sent to. If this is not set the partition will be automatically assigned.
key
If the partition is not set, records with the same key will be sent to the same partition. Since order is guaranteed within a partition, these records will be read in order they were produced.