Skip to main content
Version: 8.3 Beta 🚧

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​

TypeParameterDescription
StringconnectorThe name of the Kafka connector.
StringtopicThe name of the Kafka topic.
StringkeyThe Kafka record key, used in identifying the record.
StringvalueThe Kafka record value you want to send.
IntegerpartitionThe partition to target. Optional.
LongtimestampThe record timestamp, in milliseconds. Optional.
ListheaderKeysThe header keys for the record. Optional.
ListheaderValuesThe header values for the record. Optional.
DictionaryoptionsCustom 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)