FakeProducer
faststream.kafka.testing.FakeProducer #
Bases: AioKafkaFastProducer
A fake Kafka producer for testing purposes.
This class extends AioKafkaFastProducer and is used to simulate Kafka message publishing during tests.
Source code in faststream/kafka/testing.py
stop async
#
publish async
#
publish(
message,
topic,
key=None,
partition=None,
timestamp_ms=None,
headers=None,
correlation_id=None,
*,
reply_to="",
rpc=False,
rpc_timeout=None,
raise_timeout=False,
no_confirm=False,
)
Publish a message to the Kafka broker.
Source code in faststream/kafka/testing.py
request async
#
request(
message,
topic,
key=None,
partition=None,
timestamp_ms=None,
headers=None,
correlation_id=None,
*,
timeout=0.5,
)
Source code in faststream/kafka/testing.py
publish_batch async
#
publish_batch(
*msgs,
topic,
partition=None,
timestamp_ms=None,
headers=None,
reply_to="",
correlation_id=None,
no_confirm=False,
)
Publish a batch of messages to the Kafka broker.