emag-tech-labs/messenger-mongo-bundle

A Mongo transport for the Symfony Messenger component

Installs: 94 219

Dependents: 0

Suggesters: 0

Security: 0

Stars: 13

Watchers: 7

Forks: 10

Open Issues: 2

Type:symfony-bundle

1.3.0 2024-03-29 22:21 UTC

This package is auto-updated.

Last update: 2024-10-29 23:29:11 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
                    enable_writeConcern_majority: false # default is true

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
$ php 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
$ php bin/console messenger:failed:remove

# displays the number of queued messages in all transports
$ php bin/console messenger:stats

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.