Kafka Producer Client (producer/kafka.py)

kafka-python · kafka/producer/kafka.py · python · Apache-2.0
infra, integration, chat, realtime, lang:python

A Python Kafka producer implementation supporting batching, serialization, and transaction management. Reuse when publishing messages to Apache Kafka topics.

# Source: https://github.com/dpkp/kafka-python | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
import atexit
import copy
import logging
import selectors
import socket
import threading
import warnings
import weakref

import kafka.errors as Errors
from kafka.net.compat import KafkaNetClient
from kafka.codec import has_gzip, has_snappy, has_lz4, has_zstd
from kafka.metrics import MetricConfig, Metrics
from kafka.partitioner import Partitioner, DefaultPartitioner
from kafka.producer.future import FutureRecordMetadata, FutureProduceResult
from kafka.producer.record_accumulator import AtomicInteger, RecordAccumulator
from kafka.producer.sender import Sender
from kafka.producer.transactio

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key