Kafka
Generated from the type stubs and docstrings. Do not edit by hand.
Fields:
principal: strhost: stroperation: AclOperationpermission_type: AclPermissionType
AclCreation
Section titled “AclCreation”Fields:
resource_type: AclResourceTyperesource_name: strprincipal: strhost: stroperation: AclOperationpermission_type: AclPermissionType
AclFilter
Section titled “AclFilter”Fields:
resource_type: AclResourceTyperesource_name: Optional[str]principal: Optional[str]host: Optional[str]operation: AclOperationpermission_type: AclPermissionType
AclOperation
Section titled “AclOperation”Fields:
UNKNOWN: intANY: intALL: intREAD: intWRITE: intCREATE: intDELETE: intALTER: intDESCRIBE: intCLUSTER_ACTION: intDESCRIBE_CONFIGS: intALTER_CONFIGS: intIDEMPOTENT_WRITE: int
AclPermissionType
Section titled “AclPermissionType”Fields:
UNKNOWN: intANY: intDENY: intALLOW: int
AclResource
Section titled “AclResource”Fields:
resource_type: AclResourceTyperesource_name: stracls: Any
AclResourceType
Section titled “AclResourceType”Fields:
UNKNOWN: intANY: intTOPIC: intGROUP: intCLUSTER: intTRANSACTIONAL_ID: intDELEGATION_TOKEN: int
AclResult
Section titled “AclResult”Fields:
error: str
AdminError
Section titled “AdminError”AlterConfigOpType
Section titled “AlterConfigOpType”Fields:
SET: intDELETE: intAPPEND: intSUBTRACT: int
ArrowBatch
Section titled “ArrowBatch”Rust-decoded Arrow RecordBatch handle (from poll_arrow).
Exports the Arrow PyCapsule C-stream interface, so pyarrow/polars/duckdb/ deltalake consume it zero-copy. Re-consumable: each arrow_c_stream call clones the (Arc-backed) batch, so re-writing it on a sink retry is safe.
Fields:
num_rows: int
ArrowPollResult
Section titled “ArrowPollResult”Result of poll_arrow: the decoded batch plus consumed offsets.
Fields:
batch: ArrowBatchoffsets: Any
AsyncKafkaConsumer
Section titled “AsyncKafkaConsumer”close(self) -> Nonepoll_batch
Section titled “poll_batch”poll_batch(self, max_records: int = 500, timeout_ms: int = 500) -> Anypoll_bytes_batch
Section titled “poll_bytes_batch”poll_bytes_batch(self, max_records: int = 500, timeout_ms: int = 500) -> Anyconsume
Section titled “consume”consume(self, max_records: int = 500, timeout_ms: int = 500) -> Anystore_offsets
Section titled “store_offsets”store_offsets(self, batch_or_offsets: Any) -> Anycommit
Section titled “commit”commit(self, batch: Optional[Any] = None) -> Anycommit_offsets
Section titled “commit_offsets”commit_offsets(self, offsets: Any) -> Anysubscribe
Section titled “subscribe”subscribe(self, topics: Any, on_assign: Optional[Any] = None, on_revoke: Optional[Any] = None, on_lost: Optional[Any] = None) -> Anyunsubscribe
Section titled “unsubscribe”unsubscribe(self) -> Anyassign
Section titled “assign”assign(self, partitions: Any) -> Anyunassign
Section titled “unassign”unassign(self) -> Anyassignment
Section titled “assignment”assignment(self) -> Anyseek(self, topic_partition: Any, offset: int) -> Anyseek_to_beginning
Section titled “seek_to_beginning”seek_to_beginning(self, topic_partition: Any) -> Anyseek_to_end
Section titled “seek_to_end”seek_to_end(self, topic_partition: Any) -> Anycommitted
Section titled “committed”committed(self, topic_partition: Any) -> Anyposition
Section titled “position”position(self, topic_partition: Any) -> intget_watermark_offsets
Section titled “get_watermark_offsets”get_watermark_offsets(self, topic_partition: Any) -> Anyoffsets_for_times
Section titled “offsets_for_times”offsets_for_times(self, tp_timestamps: Any) -> Anypause(self, partitions: Optional[Any] = None) -> Anyresume
Section titled “resume”resume(self, partitions: Optional[Any] = None) -> Anylist_topics
Section titled “list_topics”list_topics(self) -> Anysubscription
Section titled “subscription”subscription(self) -> Anylag(self) -> Anymemberid
Section titled “memberid”memberid(self) -> strconsumer_group_metadata
Section titled “consumer_group_metadata”consumer_group_metadata(self) -> AnyAsyncKafkaProducer
Section titled “AsyncKafkaProducer”close(self) -> Noneproduce
Section titled “produce”produce(self, topic: str, value: bytes, key: Optional[bytes] = None) -> Anyproduce_many_bytes
Section titled “produce_many_bytes”produce_many_bytes(self, topic: str, values: Any, keys: Optional[Any] = None) -> Anyproduce_many_json
Section titled “produce_many_json”produce_many_json(self, topic: str, values: Any, keys: Optional[Any] = None) -> Anyproduce_many_avro
Section titled “produce_many_avro”produce_many_avro(self, topic: str, values: Any, serde: Any, keys: Optional[Any] = None) -> Anyproduce_many_bytes_sync
Section titled “produce_many_bytes_sync”produce_many_bytes_sync(self, topic: str, values: Any, keys: Optional[Any] = None) -> Anyproduce_many_json_sync
Section titled “produce_many_json_sync”produce_many_json_sync(self, topic: str, values: Any, keys: Optional[Any] = None) -> Anyflush(self, timeout_ms: Optional[int] = None) -> Anypurge(self) -> Anyproduce_many_records_sync
Section titled “produce_many_records_sync”produce_many_records_sync(self, records: Any) -> Anyproduce_many_records_txn
Section titled “produce_many_records_txn”produce_many_records_txn(self, records: Any) -> Anysend_offsets_to_transaction
Section titled “send_offsets_to_transaction”send_offsets_to_transaction(self, offsets: Any, consumer_group_metadata: Any) -> AnyBrokerMetadata
Section titled “BrokerMetadata”Fields:
node_id: inthost: strport: intrack: Optional[str]
BytesBatch
Section titled “BytesBatch”Fields:
values: objectoffsets: Anycount: int
ClusterMetadata
Section titled “ClusterMetadata”Fields:
brokers: Anycontroller_id: inttopics: Anycluster_id: Optional[str]
CommitError
Section titled “CommitError”CommitReport
Section titled “CommitReport”Fields:
committed: Any
ConfigEntry
Section titled “ConfigEntry”Fields:
name: strvalue: Optional[str]incremental_operation: Optional[AlterConfigOpType]source: ConfigSourceis_default: boolis_sensitive: boolread_only: bool
ConfigError
Section titled “ConfigError”ConfigResource
Section titled “ConfigResource”Fields:
resource_type: ResourceTypename: strset_config: Anyincremental_configs: Any
ConfigSource
Section titled “ConfigSource”Fields:
UNKNOWN: intDYNAMIC_TOPIC_CONFIG: intDYNAMIC_BROKER_CONFIG: intDYNAMIC_DEFAULT_BROKER_CONFIG: intSTATIC_BROKER_CONFIG: intDEFAULT_CONFIG: intDYNAMIC_BROKER_LOGGER_CONFIG: int
ConsumerError
Section titled “ConsumerError”ConsumerGroupDetail
Section titled “ConsumerGroupDetail”Fields:
group_id: strstate: strprotocol_type: strprotocol: strmembers: Any
ConsumerGroupInfo
Section titled “ConsumerGroupInfo”Fields:
group_id: strprotocol_type: str
ConsumerGroupMember
Section titled “ConsumerGroupMember”Fields:
member_id: strclient_id: strhost: strassignment: Any
ConsumerGroupMetadata
Section titled “ConsumerGroupMetadata”Fields:
group_id: strcoordinator_addr: str
DeletedRecords
Section titled “DeletedRecords”Fields:
low_watermark: int
DeliveryReport
Section titled “DeliveryReport”Fields:
topic: strpartition: intoffset: int
DeliveryTimeout
Section titled “DeliveryTimeout”FetchBufferFull
Section titled “FetchBufferFull”FlushReport
Section titled “FlushReport”Fields:
flushed: intelapsed_ms: int
KafkaAdminClient
Section titled “KafkaAdminClient”create_topics
Section titled “create_topics”create_topics(self, specs: Any) -> Anydelete_topics
Section titled “delete_topics”delete_topics(self, topics: Any) -> Anylist_consumer_groups
Section titled “list_consumer_groups”list_consumer_groups(self) -> Anydescribe_consumer_groups
Section titled “describe_consumer_groups”describe_consumer_groups(self, group_ids: Any) -> Anydelete_consumer_groups
Section titled “delete_consumer_groups”delete_consumer_groups(self, group_ids: Any) -> Anycreate_partitions
Section titled “create_partitions”create_partitions(self, new_partitions: Any, validate_only: bool = False, operation_timeout_ms: int = 30000) -> Anylist_topics
Section titled “list_topics”list_topics(self) -> Anydescribe_cluster
Section titled “describe_cluster”describe_cluster(self, include_authorized_operations: bool = False) -> Anydescribe_topics
Section titled “describe_topics”describe_topics(self, topics: Any, include_authorized_operations: bool = False) -> Anydescribe_configs
Section titled “describe_configs”describe_configs(self, resources: Any) -> Anydescribe_topic_config
Section titled “describe_topic_config”describe_topic_config(self, topics: Any) -> Anyincremental_alter_configs
Section titled “incremental_alter_configs”incremental_alter_configs(self, resources: Any, validate_only: bool = False) -> Anylist_offsets
Section titled “list_offsets”list_offsets(self, offset_specs: Any, isolation_level: str = 'read_committed') -> Anydelete_records
Section titled “delete_records”delete_records(self, offsets: Any, operation_timeout_ms: int = 30000) -> AnyKafkaBatch
Section titled “KafkaBatch”Fields:
records: Anyoffsets: Anycount: int
KafkaConfig
Section titled “KafkaConfig”Fields:
bootstrap_servers: strclient_id: stracks: str | intcompression: strlinger_ms: intbatch_size_bytes: intenable_idempotence: boolmessage_timeout_ms: intrequest_timeout_ms: intretry_backoff_ms: intmessage_send_max_retries: intqueue_buffering_max_messages: intqueue_buffering_max_kbytes: inttransactional_id: strsecurity_protocol: strsasl_mechanism: strsasl_username: Optional[str]sasl_password: Optional[str]oauth_cb: Optional[Any]extra: Any
KafkaConnectionError
Section titled “KafkaConnectionError”KafkaConsumer
Section titled “KafkaConsumer”poll_batch
Section titled “poll_batch”poll_batch(self, max_records: int = 10000, timeout_ms: int = 100) -> Anypoll_bytes_batch
Section titled “poll_bytes_batch”poll_bytes_batch(self, max_records: int = 10000, timeout_ms: int = 100) -> Anypoll_arrow
Section titled “poll_arrow”poll_arrow(self, max_records: int = 10000, timeout_ms: int = 100, value_format: str = 'raw', schema: Optional[str] = None, include_metadata: bool = True) -> Anystore_offsets
Section titled “store_offsets”store_offsets(self, batch_or_offsets: Any) -> Anycommit
Section titled “commit”commit(self, batch: Optional[Any] = None) -> Anycommit_offsets
Section titled “commit_offsets”commit_offsets(self, offsets: Any) -> Anysubscribe
Section titled “subscribe”subscribe(self, topics: Any, on_assign: Optional[Any] = None, on_revoke: Optional[Any] = None, on_lost: Optional[Any] = None) -> Anyunsubscribe
Section titled “unsubscribe”unsubscribe(self) -> Anyassign
Section titled “assign”assign(self, partitions: Any) -> Anyunassign
Section titled “unassign”unassign(self) -> Anyassignment
Section titled “assignment”assignment(self) -> Anyincremental_assign
Section titled “incremental_assign”incremental_assign(self, partitions: Any) -> Anyincremental_unassign
Section titled “incremental_unassign”incremental_unassign(self, partitions: Any) -> Anyseek(self, topic_partition: Any, offset: int) -> Anyseek_to_beginning
Section titled “seek_to_beginning”seek_to_beginning(self, topic_partition: Any) -> Anyseek_to_end
Section titled “seek_to_end”seek_to_end(self, topic_partition: Any) -> Anyposition
Section titled “position”position(self, topic_partition: Any) -> intcommitted
Section titled “committed”committed(self, topic_partition: Any) -> Anyget_watermark_offsets
Section titled “get_watermark_offsets”get_watermark_offsets(self, topic_partition: Any) -> Anyoffsets_for_times
Section titled “offsets_for_times”offsets_for_times(self, tp_timestamps: Any) -> Anypause(self, partitions: Optional[Any] = None) -> Anyresume
Section titled “resume”resume(self, partitions: Optional[Any] = None) -> Anylist_topics
Section titled “list_topics”list_topics(self) -> Anysubscription
Section titled “subscription”subscription(self) -> Anylag(self) -> Anymemberid
Section titled “memberid”memberid(self) -> strconsumer_group_metadata
Section titled “consumer_group_metadata”consumer_group_metadata(self) -> Anyclose(self) -> NoneKafkaConsumerConfig
Section titled “KafkaConsumerConfig”Fields:
bootstrap_servers: strtopics: list[str]group_id: strgroup_instance_id: strenable_auto_commit: boolauto_commit_interval_ms: intauto_offset_reset: strmax_poll_interval_ms: intsession_timeout_ms: intheartbeat_interval_ms: intpartition_assignment_strategy: strrebalance_timeout_ms: inttopic_metadata_refresh_interval_ms: inttopic_metadata_refresh_fast_interval_ms: intisolation_level: strmax_poll_records: intfetch_max_bytes: intfetch_mode: strsecurity_protocol: strsasl_mechanism: strsasl_username: Optional[str]sasl_password: Optional[str]oauth_cb: Optional[Any]extra: Any
KafkaError
Section titled “KafkaError”KafkaProducer
Section titled “KafkaProducer”produce
Section titled “produce”produce(self, topic: str, value: bytes, key: Optional[bytes] = None) -> ProduceReceiptproduce_many_bytes
Section titled “produce_many_bytes”produce_many_bytes(self, topic: str, values: Any, keys: Optional[Any] = None) -> ProduceReceiptproduce_many_json
Section titled “produce_many_json”produce_many_json(self, topic: str, values: Any, keys: Optional[Any] = None) -> ProduceReceiptproduce_many_avro
Section titled “produce_many_avro”produce_many_avro(self, topic: str, values: Any, serde: Any, keys: Optional[Any] = None) -> ProduceReceiptproduce_many
Section titled “produce_many”produce_many(self, records: Any) -> ProduceReceiptproduce_many_bytes_sync
Section titled “produce_many_bytes_sync”produce_many_bytes_sync(self, topic: str, values: Any, keys: Optional[Any] = None) -> Anyproduce_many_json_sync
Section titled “produce_many_json_sync”produce_many_json_sync(self, topic: str, values: Any, keys: Optional[Any] = None) -> Anyflush(self, timeout_ms: Optional[int] = None) -> Anypurge(self) -> Anyinit_transactions
Section titled “init_transactions”init_transactions(self) -> Anybegin_transaction
Section titled “begin_transaction”begin_transaction(self) -> Anycommit_transaction
Section titled “commit_transaction”commit_transaction(self) -> Anyabort_transaction
Section titled “abort_transaction”abort_transaction(self) -> Anyproduce_many_bytes_txn
Section titled “produce_many_bytes_txn”produce_many_bytes_txn(self, topic: str, values: Any, keys: Optional[Any] = None, partition: int = 0) -> Anyproduce_many_records_txn
Section titled “produce_many_records_txn”produce_many_records_txn(self, records: Any) -> Anysend_offsets_to_transaction
Section titled “send_offsets_to_transaction”send_offsets_to_transaction(self, offsets: Any, consumer_group_metadata: Any) -> Anylist_topics
Section titled “list_topics”list_topics(self) -> Anyclose(self) -> NoneKafkaRecord
Section titled “KafkaRecord”Native (Rust) record. Frozen. partition/offset are 0/-1 on the produce path.
key/timestamp_ms read back as Option (Some/Nothing); headers as IMap[str, bytes]. Ctor accepts Some(x)/Nothing OR raw values/None for key and timestamp_ms, and IMap or plain dict for headers. key/headers/timestamp_ms/value materialize lazily on first access (cached).
Fields:
topic: strvalue: bytespartition: intoffset: intkey: objectheaders: Anytimestamp_ms: object
ListOffsetsResultInfo
Section titled “ListOffsetsResultInfo”Fields:
offset: inttimestamp_ms: int
NewPartitions
Section titled “NewPartitions”Fields:
topic: strtotal_count: int
OffsetSpec
Section titled “OffsetSpec”Fields:
kind: strtimestamp_ms: int
earliest
Section titled “earliest”earliest(cls) -> OffsetSpeclatest
Section titled “latest”latest(cls) -> OffsetSpecmax_timestamp
Section titled “max_timestamp”max_timestamp(cls) -> OffsetSpecfor_timestamp
Section titled “for_timestamp”for_timestamp(cls, timestamp_ms: int) -> OffsetSpecPartitionMetadata
Section titled “PartitionMetadata”Fields:
partition_index: intleader_id: intreplicas: Anyisr: Any
PollError
Section titled “PollError”PollTimeoutExceeded
Section titled “PollTimeoutExceeded”ProduceError
Section titled “ProduceError”ProduceReceipt
Section titled “ProduceReceipt”get(self) -> Anywait(self) -> AnyProduceReport
Section titled “ProduceReport”Fields:
accepted: intdelivered: intfailed: interrors: list
QueueFull
Section titled “QueueFull”RebalanceError
Section titled “RebalanceError”ResourceType
Section titled “ResourceType”Fields:
UNKNOWN: intTOPIC: intBROKER: int
TopicMetadata
Section titled “TopicMetadata”Fields:
name: strpartitions: Anyis_internal: boolerror: Optional[str]
TopicPartition
Section titled “TopicPartition”Fields:
topic: strpartition: int
TopicResult
Section titled “TopicResult”Fields:
name: strerror: str
TopicSpec
Section titled “TopicSpec”Fields:
name: strnum_partitions: intreplication_factor: intconfig: Any
Functions
Section titled “Functions”avro_schema_dict
Section titled “avro_schema_dict”avro_schema_dict(model: type, name: Optional[str] = None) -> dictavro_schema_json
Section titled “avro_schema_json”avro_schema_json(schema: Any) -> strconsume
Section titled “consume”consume(consumer: KafkaConsumer, max_records: int = 500, timeout_ms: int = 500) -> Generator[KafkaRecord]Convenience generator: yields KafkaRecord objects one at a time.
Usage: for record in consume(consumer, max_records=100): process(record)
Stops only on StopIteration (never blocks forever); caller must break out.
is_schema_type
Section titled “is_schema_type”is_schema_type(t: Any) -> booljson_schema_json
Section titled “json_schema_json”json_schema_json(schema: Any) -> str