Kafka producer wrapper.
Definition at line 39 of file classes.py.
Public Member Functions | |
| __init__ (self, bool enabled, str bootstrap_servers) | |
| start (self) | |
| send (self, str topic, str|bytes key, str|bytes value, int|None partition=None, Headers|None headers=None) | |
| Sends the message (value) to topic by key and, optionally, to a given partition and waits until it is delivered. | |
| send_async (self, str topic, str|bytes key, str|bytes value, int|None partition=None, Headers|None headers=None) | |
| Sends the message (value) to topic by key and, optionally, to a given partition and returns the future for message delivery awaiting. | |
| aclose (self) | |
Public Attributes | |
| producer | |
Protected Member Functions | |
| _flush (self) | |
Protected Attributes | |
| _enabled = enabled | |
| _bootstrap_servers = bootstrap_servers | |
| testsuite.databases.kafka.classes.KafkaProducer.__init__ | ( | self, | |
| bool | enabled, | ||
| str | bootstrap_servers ) |
Definition at line 44 of file classes.py.
|
protected |
Definition at line 115 of file classes.py.
| testsuite.databases.kafka.classes.KafkaProducer.aclose | ( | self | ) |
Definition at line 119 of file classes.py.
| testsuite.databases.kafka.classes.KafkaProducer.send | ( | self, | |
| str | topic, | ||
| str | bytes | key, | ||
| str | bytes | value, | ||
| int | None | partition = None, | ||
| Headers | None | headers = None ) |
Sends the message (value) to topic by key and, optionally, to a given partition and waits until it is delivered.
If the call is successfully awaited, message is guaranteed to be delivered.
:param topic: topic name. :param key: key. Needed to determine message's partition. :param value: message payload. Must be valid UTF-8. :param partition: Optional message partition. If not passed, determined by internal partitioner depends on key's hash.
Definition at line 56 of file classes.py.
| testsuite.databases.kafka.classes.KafkaProducer.send_async | ( | self, | |
| str | topic, | ||
| str | bytes | key, | ||
| str | bytes | value, | ||
| int | None | partition = None, | ||
| Headers | None | headers = None ) |
Sends the message (value) to topic by key and, optionally, to a given partition and returns the future for message delivery awaiting.
:param topic: topic name. :param key: key. Needed to determine message's partition. :param value: message payload. Must be valid UTF-8. :param partition: Optional message partition. If not passed, determined by internal partitioner depends on key's hash.
Definition at line 83 of file classes.py.
| testsuite.databases.kafka.classes.KafkaProducer.start | ( | self | ) |
Definition at line 48 of file classes.py.
|
protected |
Definition at line 46 of file classes.py.
|
protected |
Definition at line 45 of file classes.py.
| testsuite.databases.kafka.classes.KafkaProducer.producer |
Definition at line 50 of file classes.py.