PHPackages                             adtechpotok/enqueue-messenger-adapter-bundle - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. adtechpotok/enqueue-messenger-adapter-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

adtechpotok/enqueue-messenger-adapter-bundle
============================================

0.1.22(7y ago)136[1 issues](https://github.com/adtechpotok/enqueue-messenger-adapter/issues)MITPHPPHP &gt;=7.1

Since Jun 14Pushed 7y agoCompare

[ Source](https://github.com/adtechpotok/enqueue-messenger-adapter)[ Packagist](https://packagist.org/packages/adtechpotok/enqueue-messenger-adapter-bundle)[ RSS](/packages/adtechpotok-enqueue-messenger-adapter-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (11)Versions (25)Used By (0)

Enqueue's transport for Symfony Messenger component
===================================================

[](#enqueues-transport-for-symfony-messenger-component)

This Symfony Messenger transport allows you to use Enqueue to send and receive your messages from all the supported brokers.

Usage
-----

[](#usage)

1. Install the transport

```
composer req enqueue/messenger-adapter

```

2. Configure the Enqueue bundle as you would normaly do ([see Enqueue's Bundle documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md)). If you are using the recipes, you should just have to configure the environment variables to configure the `default` Enqueue transport:

```
# .env
# ...

###> enqueue/enqueue-bundle ###
ENQUEUE_DSN=amqp://guest:guest@localhost:5672/%2f
###< enqueue/enqueue-bundle ###
```

3. Configure Messenger's transport (that we will name `amqp`) to use Enqueue's `default` transport:

```
# config/packages/messenger.yaml
framework:
    messenger:
        transports:
            amqp: enqueue://default
```

4. Route the messages that have to go through the message queue:

```
# config/packages/framework.yaml
framework:
    messenger:
        # ...

        routing:
            'App\Message\MyMessage': amqp
```

5. Consume!

```
bin/console messenger:consume-messages amqp
```

Advanced usage
--------------

[](#advanced-usage)

### Configure the queue(s) and exchange(s)

[](#configure-the-queues-and-exchanges)

In the transport DSN, you can add extra configuration. Here is the reference DSN (note that the values are just for the example):

```
enqueue://default
	?queue[routingKey][name]=queue_name
	&topic[name]=topic_name
    &topic[type]=topic|fanout|direct
    &deliveryDelay=1800
    &delayStrategy=Adtechpotok\Bundle\EnqueueMessengerAdapterBundle\Transport\RabbitMq375DelayPluginDelayStrategy
    &timeToLive=3600
    &receiveTimeout=1000
    &priority=1
    &maximumPriority=255
    &durability=1

```

```
# config/packages/messenger.yaml
framework:
    messenger:
        transports:
            events: enqueue://default?queue[*][name]=events&topic[name]=events&topic[type]=topic
            foo.events: enqueue://default?queue[foo][name]=foo.events&topic[name]=events&topic[type]=topic
            bar.events: enqueue://default?queue[bar][name]=bar.events&topic[name]=events&topic[type]=topic

        routing:
            App\Message\EventsMessage: events
            Foo\Message\EventsMessage: foo.events
            Bar\Message\EventsMessage: bar.events
```

### Send a message on a specific topic

[](#send-a-message-on-a-specific-topic)

You can send a message on a specific topic using `TransportConfiguration` envelope item with your message:

```
use Enqueue\MessengerAdapter\EnvelopeItem\TransportConfiguration;

// ...

$this->bus->dispatch((new Envelope($message))->with(new TransportConfiguration(
    ['topic' => 'specific-topic']
)));
```

Message duplication preventing
------------------------------

[](#message-duplication-preventing)

This package provide deduplication mechanism based on Redis optimistic locking (there is documentation  "Optimistic locking using check-and-set"). It uses two dependencies which you have to implement by yourself.

1. Configure UuidItemSetterMiddleware on produce bus. It will store UUID-4 identifier in envelope items.

```
# config/packages/messenger.yaml
framework:
    messenger:
        buses:
            messenger.produce:
                middleware:
                    - Adtechpotok\Bundle\EnqueueMessengerAdapterBundle\Middleware\UuidItemSetterMiddleware
```

2. Implement UniqueIdGetterInterface interface and register it as a service.

That interface will be used every time when LockBasedDeduplicationMiddleware will process a message. The method getUniqueId have to return a unique id each time when it will be called. LockBasedDeduplicationMiddleware will try to lock a message by this id. If it succeeds the message will be processed next otherwise you will get an exception.

Example:

```
class IdGenerator implements UniqueIdGetterInterface
{
    /** @var string */
    protected $id;

    public function __construct()
    {
        $this->generateId();
    }

    /**
     * @return string
     */
    public function getUniqueId(): string
    {
        return $this->id;
    }

    public function generateId(): void
    {
        $this->id = uniqid('', true);
    }
}
```

```
#config/services.yaml
services:
    SystemBundle\Classes\IdGenerator:
```

3. Register redis-locker and deduplication middleware

```
system.middleware.service.locker:
    class: Adtechpotok\Bundle\EnqueueMessengerAdapterBundle\Service\RedisLockService
    arguments:
        - '@REDIS_CLIENT'
        - 'rabbit_mq_'
        - 172800
        - 'worker_id'

messenger.middleware.lock_based_deduplication:
    class: Adtechpotok\Bundle\EnqueueMessengerAdapterBundle\Middleware\LockBasedDeduplicationMiddleware
    arguments:
        - '@system.middleware.service.locker'
        - '@SystemBundle\Classes\IdGenerator'
```

Where @REDIS\_CLIENT is your configured redis client.

4. Configure LockBasedDeduplicationMiddleware

```
common:
    messenger:
        buses:
            messenger.consume:
                middleware:
                    - messenger.middleware.lock_based_deduplication
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

23

Last Release

2784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad54d65a1e9cce303378cc8f6328e8dda4bba1bbf596910b52d4c8c4ec342619?d=identicon)[scarbo87](/maintainers/scarbo87)

---

Top Contributors

[![covobo](https://avatars.githubusercontent.com/u/6328862?v=4)](https://github.com/covobo "covobo (5 commits)")

---

Tags

deduplicationmessengeropentracingsymfony4

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adtechpotok-enqueue-messenger-adapter-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/adtechpotok-enqueue-messenger-adapter-bundle/health.svg)](https://phpackages.com/packages/adtechpotok-enqueue-messenger-adapter-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[mmoreram/gearman-bundle

Adds gearman support to your and Symfony4, Symfony5 project

237395.2k2](/packages/mmoreram-gearman-bundle)[ecotone/symfony-bundle

Extends Ecotone with Symfony integration

11229.0k1](/packages/ecotone-symfony-bundle)

PHPackages © 2026

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