> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# KafkaStream

> atoti\_kafka.KafkaStream(\
>
>     *bootstrap\_server*: [str](https://docs.python.org/3/builtins/stdtypes.html#str),\
>
>     *topic*: [str](https://docs.python.org/3/builtins/stdtypes.html#str),\
>
>     *group\_id*: [str](https://docs.python.org/3/builtins/stdtypes.html#str),\
>
>     \*,\
>
>     *batch\_duration*: [timedelta](https://docs.python.org/3/library/datetime.html#datetime.timedelta) = `datetime.timedelta(seconds=1)`,\
>
>     *consumer\_config*: [Mapping](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping)\[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)] = `frozendict({})`,\
>
> )

Consume a Kafka topic and stream its records in the table.

The records’ key deserializer default to [StringDeserializer](https://kafka.apache.org/21/javadoc/org/apache/kafka/common/serialization/StringDeserializer.html).

The records’ message must be a JSON object with columns’ name as keys.

**See also**:
The other [`DataStream`](./atoti.data_stream.DataStream#atoti.data_stream.DataStream) implementations.

### Attributes

#### *bootstrap\_server*

`host[:port]` that the consumer should contact to bootstrap initial cluster metadata.

#### *topic*

Topic to subscribe to.

#### *group\_id*

The name of the consumer group to join.

#### *batch\_duration*

Time spent batching received events before publishing them to the table in a single transaction.

#### *consumer\_config*

Mapping containing optional parameters to set up the KafkaConsumer.

The list of available params can be found [here](https://kafka.apache.org/10/javadoc/index.html?org/apache/kafka/clients/consumer/ConsumerConfig.html).
