emag-tech-labs/messenger-mongo-bundle

A Mongo transport for the Symfony Messenger component

Installs: 7 663

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 8

Forks: 7

Open Issues: 2

Type:symfony-bundle

1.0.0 2021-07-06 11:53 UTC

This package is auto-updated.

Last update: 2021-11-02 19:17:47 UTC


README

Packagist Version GA build codecov Mutation testing badge
This bundle offers a new type of transport for the Symfony Messenger component. While MongoDB is not the best tool to be used as a queue, sometimes it's more convenient to use the tools that your application already uses. For example, if your application already uses MongoDB and you want a persistent storage for the failed messages, I think it's quite handy to use MongoDB as a storage.

Installation

The recommended way to install the bundle is through Composer:

$ composer require emag-tech-labs/messenger-mongo-bundle

Configuration & usage

Take a look here if you need to find out how to configure the driverOptions, uriOptions and dsn options.

framework:
    messenger:
        transports:
            hello_queue:
                dsn: mongodb://127.0.0.1:27017
                options:
                    uriOptions: []
                    driverOptions: []
                    database: symfony # required
                    collection: hello_messages # default is "messenger_queue"
                    queue: hello_queue # default is "default"
                    redeliver_timeout: 4800 # default is 3600

The features described here can be used also, therefore the following commands are available in order to manually debug the failed messages:

# see all messages in the failure transport
$ bin/console messenger:failed:show

# see details about a specific failed message
$ php bin/console messenger:failed:show 20 -vv

# view and retry messages one-by-one
$ php bin/console messenger:failed:retry -vv

# retry specific messages
$ php bin/console messenger:failed:retry 20 30 --force

# remove a message without retrying it
$ bin/console messenger:failed:remove

Submitting bugs and feature requests

If you found a nasty bug or want to propose a new feature, you're welcome to open an issue or create a pull request here.