system.kafka.sendRecord
This function is used in Python Scripting.
Description​
Sends a record to a specified topic, with further sends blocked until a response is received. This is considerably slower than system.kafka.sendRecordAsync, and should only be used if a metadata response is required.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.kafka.sendRecord(connector, topic, key, value, [partition], [timestamp], [headerKeys], [headerValues], [options])
Parameters​
Type | Parameter | Description |
---|---|---|
String | connector | The name of the Kafka connector. |
String | topic | The name of the Kafka topic. |
String | key | The Kafka record key, used in identifying the record. |
String | value | The Kafka record value you want to send. |
Integer | partition | The partition to target. Optional. |
Long | timestamp | The record timestamp, in milliseconds. Optional. |
List | headerKeys | The header keys for the record. Optional. |
List | headerValues | The header values for the record. Optional. |
Dictionary | options | Custom options specific to the producer, with key value string pairs. Optional. |
Returns​
PyDictionary - A PyDictionary representing metadata response in key value pairs. The metadata contains keys for:
- topic
- partition
- offset
- timestamp
Scope​
Gateway
Code Examples​
Example #1
# Sends a record to the specified topic, with further sends blocked until a response is received.
system.kafka.sendRecord("MyKafkaConnector", "MyKafkaTopic", k2, 25)