providers.akafka.KafkaOutboxSubscriber

Apache Kafka-specific provider using translators that implement the

Usage

Source

providers.akafka.KafkaOutboxSubscriber(
    *,
    event_subscriber,
)

DaoSubscriberProtocol.

Notes

this class can be replaced by using the ComboTranslator in conjunction with the normal KafkaEventSubscriber class. We may therefore deprecate this class in the near future.

Methods

Name Description
__init__() Please do not call directly! Should be called by the construct method.
construct() Setup and teardown an instance of the provider.
run() Start consuming events from the Kafka outbox.

__init__()

Please do not call directly! Should be called by the construct method.

Usage

Source

__init__(*, event_subscriber)


construct()

Setup and teardown an instance of the provider.

Usage

Source

construct(
    *,
    config,
    translators,
    dlq_publisher=None,
    kafka_consumer_cls=AIOKafkaConsumer
)

Args: - config: MongoDB-specific config parameters. - translators: A sequence of translators implementing the DaoSubscriberProtocol. - dlq_publisher: An instance of the publisher to use for the DLQ. Can be None if not using the dead letter queue. It is used to publish events to the DLQ. - kafka_consumer_cls: The Kafka consumer class to use. Defaults to AIOKafkaConsumer.

Returns
AsyncGenerator[KafkaOutboxSubscriber, None]
An instance of the provider.


run()

Start consuming events from the Kafka outbox.

Usage

Source

run(forever=True)
Parameters
forever: bool = True
Whether to run the consumer indefinitely. Defaults to True.