Skip to content

tailrdigital/sulu-messenger-failed-queue-bundle

Repository files navigation

Sulu Messenger Failed Queue

This package provides a Sulu admin panel for managing the failed messages in the failure queue of symfony/messenger.

Via the admin panel you are able to check the error/exception details of each failed message, and you can trigger a requeue/retry if needed.

Demo

failed-queue-sulu.mov

Installation

composer require tailrdigital/sulu-messenger-failed-queue-bundle

Register the bundle

Make sure the bundle is activated in config/bundles.php:

Tailr\SuluMessengerFailedQueueBundle\SuluMessengerFailedQueueBundle::class => ['all' => true]

Register new admin routes

You need to manually register the failed queue admin controller routes in the file config/routes_admin.yaml.

# config/routes_admin.yaml

tailr_failed_queue:
    resource: '@SuluMessengerFailedQueueBundle/Presentation/Controller/Admin'
    type: attribute
    prefix: /admin/api

Add node dependency

Register an additional module in your admin's node dependencies via assets/admin/package.json:

{
  "dependencies": {
    "sulu-messenger-failed-queue-bundle": "file:node_modules/@sulu/vendor/tailrdigital/sulu-messenger-failed-queue-bundle/assets/admin"
  }  
}

Make sure to load the additional node module in your admin's assets/admin/index.js or assets/admin/app.js file:

import 'sulu-messenger-failed-queue-bundle';

Recompile your admin assets

cd /app/assets/admin
npm install
npm run watch

Setting up your failure queue

You can set up the symfony/messenger queue according to this example configuration inside config/packages/messenger.yaml

# config/packages/messenger.yaml

framework:
    messenger:
        failure_transport: failed
        transports:
            async: '%env(MESSENGER_TRANSPORT_ASYNC_DSN)%'
            failed: 'doctrine://default?queue_name=failed'

Permissions

Make sure you've set the correct permissions in the Sulu admin for this package. Go to Settings > User Roles and enable the permissions you need. Afterwards you could find the Failed Queue view/panel via Settings > Failed Queue.

Configuration

If you have a non-default failure queue configuration, you are able to overwrite our default settings by creating a config/packages/sulu_messenger_failed_queue.yaml file.

# config/packages/sulu_messenger_failed_queue.yaml

sulu_messenger_failed_queue:
    failure_transport_service: 'messenger.transport.failed_high_priority' # Default 'messenger.transport.failed'
    failure_transport_table: 'failed_messages' # Default 'messenger_messages'
    failure_transport_queue_name: 'failed_high_priority' # Default 'failed'

If needed you can define the configured (failed) transport service definition or alias name via failure_transport_service. On the other hand you could modify the database table name via failure_transport_table and define the (failed) queue name via failure_transport_queue_name.

Known limitations

The symfony/messenger package has support for multiple failure queues/transports, but this package only has support for visualizing and managing one (doctrine) failure queue/transport.