## providers.akafka.KafkaOutboxSubscriber

<span id="hexkit.providers.akafka.KafkaOutboxSubscriber"></span>


Apache Kafka-specific provider using translators that implement the


Usage

``` python
providers.akafka.KafkaOutboxSubscriber(
    *,
    event_subscriber,
)
```


[DaoSubscriberProtocol](protocols.daosub.DaoSubscriberProtocol.md#hexkit.protocols.daosub.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__()](#__init__) | Please do not call directly! Should be called by the [construct](providers.mongodb.MongoDbDaoFactory.md#hexkit.providers.mongodb.MongoDbDaoFactory.construct) method. |
| [construct()](#construct) | Setup and teardown an instance of the provider. |
| [run()](#run) | Start consuming events from the Kafka outbox. |

<span id="__init__"></span>

<span id="hexkit.providers.akafka.KafkaOutboxSubscriber.__init__"></span>


#### \_\_init\_\_()


Please do not call directly! Should be called by the [construct](providers.mongodb.MongoDbDaoFactory.md#hexkit.providers.mongodb.MongoDbDaoFactory.construct) method.


Usage

``` python
__init__(*, event_subscriber)
```


<span id="hexkit.providers.akafka.KafkaOutboxSubscriber.construct"></span>

------------------------------------------------------------------------


#### construct()


Setup and teardown an instance of the provider.


Usage

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


Args: - `config`: MongoDB-specific config parameters. - `translators`: A sequence of translators implementing the [DaoSubscriberProtocol](protocols.daosub.DaoSubscriberProtocol.md#hexkit.protocols.daosub.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.


<span id="hexkit.providers.akafka.KafkaOutboxSubscriber.run"></span>

------------------------------------------------------------------------


#### run()


Start consuming events from the Kafka outbox.


Usage

``` python
run(forever=True)
```


##### Parameters


`forever: bool = ``True`  
Whether to run the consumer indefinitely. Defaults to True.
