4.4.0
·
7 commits
to master
since this release
Added
Adapters - Kafka
- Async Kafka Producer Adapter - Introduced
AsyncKafkaProducerAdapterfor non-blocking message production using
confluent-kafka's thread-based async delivery model.- Implements the new
AsyncKafkaProducerPortinterface withasync produce,async flush, andasync close
methods - Lazy-initialises the underlying
confluent-kafkaProduceron first use to avoid blocking the event loop at
construction time - Supports configurable worker threads (
kafka_async_worker_threads) and buffer flush timeout
(kafka_async_buffer_timeout_seconds) viaKafkaConfig
- Implements the new
- Async Kafka Consumer Adapter - Introduced
AsyncKafkaConsumerAdapterfor non-blocking message consumption.- Implements the new
AsyncKafkaConsumerPortinterface withasync consume,async subscribe,async commit,
andasync closemethods - Offloads blocking
confluent-kafkaConsumercalls to a thread pool executor to keep the event loop free
- Implements the new
- Async Kafka Ports - Added
AsyncKafkaProducerPortandAsyncKafkaConsumerPortabstract base classes to
archipy/adapters/kafka/ports.py.- Defines the async contract that all async Kafka adapter implementations must satisfy
- Close Methods on Sync Adapters - Added explicit
close()methods toKafkaConsumerAdapterand
KafkaProducerAdapterfor deterministic resource cleanup.
Configs - Kafka
- Async Kafka Config Fields - Extended
KafkaConfigwith two new settings for the async adapters.kafka_async_worker_threads: int— number of threads in the async executor pool (default4)kafka_async_buffer_timeout_seconds: float— maximum seconds to wait when flushing the producer buffer on close
(default5.0)
Tests - Kafka
- Async BDD Scenarios - Expanded
features/kafka_adapters.featurewith end-to-end scenarios for
AsyncKafkaProducerAdapterandAsyncKafkaConsumerAdapter.- Covers produce, consume, subscribe, commit, flush, and close lifecycle
- Step implementations in
features/steps/kafka_adapter_steps.pyuseawaitthroughout instead of
asyncio.run()
Changed
Tests - BDD
- Async Step Implementations - Refactored all async Behave step functions across multiple feature files to use
awaitinstead ofasyncio.run().- Affected files:
atomic_transaction_steps.py,error_utils_steps.py,grpc_error_handling_steps.py,
metric_interceptor_steps.py - Eliminates nested event-loop errors when steps run inside an already-running loop
- Affected files:
test_helpers.pyCleanup - Removed deprecated utility functions fromfeatures/test_helpers.pythat were
superseded by the async step refactor.
Chore
Docs - Kafka
- Kafka Tutorial Expansion - Substantially expanded
docs/tutorials/adapters/kafka.mdto document all five
adapter classes (KafkaAdminAdapter,KafkaConsumerAdapter,KafkaProducerAdapter,
AsyncKafkaConsumerAdapter,AsyncKafkaProducerAdapter).- Added dedicated sections for async adapters, lazy initialisation behaviour, and usage in non-async contexts
- Improved logging examples for consistency with documentation standards
- Kafka API Reference Update - Updated
docs/api_reference/adapters/kafka.mdto list all five adapter classes
and their async configuration options. - Documentation Admonition Style - Migrated all admonitions across 19 documentation files from MkDocs
!!!
directives to block-quote callouts (> **Type:** ...) to prevent formatting issues in PyCharm. - Quickstart Redis Update - Updated
docs/getting-started/quickstart.mdto reflect the current Redis caching
implementation. - BDD Testing Rule Update - Clarified Behave version (1.3.3) and async step conventions in
.cursor/rules/testing-bdd.mdc.
Full Changelog: 4.3.6...4.4.0