PHPackages                             adexos/m2-kafka-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. adexos/m2-kafka-connector

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

adexos/m2-kafka-connector
=========================

Kafka module with Avro support

v1.0.12(6mo ago)31.9k↓38.9%MITPHPPHP ^8.1

Since Jun 18Pushed 6mo ago3 watchersCompare

[ Source](https://github.com/adexos/m2-kafka-connector)[ Packagist](https://packagist.org/packages/adexos/m2-kafka-connector)[ RSS](/packages/adexos-m2-kafka-connector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (18)Used By (0)

Adexos Kafka Connector
======================

[](#adexos-kafka-connector)

This module is a bridge of [koco/messenger-kafka](https://github.com/KonstantinCodes/messenger-kafka/tree/master) for Magento 2.

It is built to use Magento 2 native queue system with some adjustments to the settings.

It also handles reading with Avro Schemes.

Disclaimer
----------

[](#disclaimer)

Only the reading part is done from now. You can't write to a queue.

Installation
------------

[](#installation)

```
composer require adexos/m2-kafka-connector
```

Usage
-----

[](#usage)

### Declare your configuration

[](#declare-your-configuration)

To do so, you can simply include in your `app/code/Namespace/Module/etc/adminhtml/system.xml` the kafka configuration form :

```

                Warehouse

```

Please note the `group id` you set, it will be used to connect the queue runner to the Kafka broker

You can find the configuration here : `Stores -> Configuration -> Services -> Kafka`

### Add the queue system

[](#add-the-queue-system)

#### Communication

[](#communication)

`app/code/Namespace/Module/etc/communication.xml`

```

```

The `request` field will be used as the model of the message you are receiving.

This class **must be full typed with PhpDoc** because of Magento 2 requirements

> Please note that the `topic name` DO NOT HAVE to be the same as the Kafka queue you are looking for. Since most of Kafka queues are in the same broker but have different names depending on the environment, we cannot define them in .xml as we do for other connection types like `db` queues
>
> Instead, the real Kafka topic name must be defined in the system you have set earlier.\*\*

#### Queue consumer

[](#queue-consumer)

`app/code/Namespace/Module/etc/queue_consumer.xml`

```

```

- `queue` : as per Magento doc, it must be identical to the topic name defined in the `communication.xml` file
- `connection` : please note that the Kafka connection **must** starts with `kafka.`, for example : `kafka.warehouse`. This is done to detect **all** kafka connection types and to retrieve them in the configuration defined.

> If connection is `kafka.warehouse`, the group id defined in the system.xml file but be `warehouse`. This allow us to map through the `core_config_data` table automatically

- `handler` : The handler that will take your message and process it. The parameter type must be as same type as the one defined in `communication.xml` inside the `request` field
- `onlySpawnWhenMessageAvailable` : this flag must be set to zero. Since natively Magento only spawns a consumer when there is a message available, the Kafka consumer will be spawned and despawned endlessly. A Kafka consumer only commits its offset when a message is read. However, if no message is read and no offset is committed yet, the next time the consumer will spawn, it'll ready from the very end of the queue. Adding this flag ensure that a message will be read at least once and the offset will be commited. In fact, you can remove it after the offset is commit (manually or automatically). It is not advised to do so.

#### High performance queue

[](#high-performance-queue)

You might need to have a better performance for your queue. To do so, you can add leverage the power of headers from Kafka message if your messages has some. If you can filter only needed messages by reading headers, you can just skip the Avro deserialization and avoid a lot of processing time.

Here is how you can do it :

`app/code/Namespace/Module/etc/di.xml`

```

                Namespace\Module\Serializer\HeaderFilter\YourCustomAvroHeaderFilter

```

`your.magento.topic.name` : must be replaced by the topic name you defined in `communication.xml` file. `Namespace\Module\Serializer\HeaderFilter\YourCustomAvroHeaderFilter` : must be replaced by your custom header filter

Your custom header filter must implement the `Adexos\KafkaConnector\Serializer\HeaderFilter\AvroHeaderFilterInterface`and the serializer will automatically pass the headers to your filter if it exists for your topic.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance65

Regular maintenance activity

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~40 days

Recently: every ~77 days

Total

13

Last Release

209d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40057495?v=4)[Adexos](/maintainers/Adexos)[@adexos](https://github.com/adexos)

---

Top Contributors

[![MeCapron](https://avatars.githubusercontent.com/u/49562288?v=4)](https://github.com/MeCapron "MeCapron (13 commits)")[![baudeval](https://avatars.githubusercontent.com/u/58520315?v=4)](https://github.com/baudeval "baudeval (4 commits)")

### Embed Badge

![Health badge](/badges/adexos-m2-kafka-connector/health.svg)

```
[![Health](https://phpackages.com/badges/adexos-m2-kafka-connector/health.svg)](https://phpackages.com/packages/adexos-m2-kafka-connector)
```

###  Alternatives

[spatie/laravel-event-sourcing

The easiest way to get started with event sourcing in Laravel

9003.7M26](/packages/spatie-laravel-event-sourcing)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
