Search by

eurekos / symfony-messenger-monitor

pavloshevchuk

A simple Symfony bundle to view the current Messenger queue.

Package info

github.com/eurekos/symfony-messenger-monitor

Type:symfony-bundle

pkg:composer/eurekos/symfony-messenger-monitor

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-06-05 08:11 UTC

This package is not auto-updated.

Last update: 2026-11-07 08:38:16 UTC


README

A Symfony bundle to view the current Symfony Messenger queue in the browser.

What it does:

  • Lists every configured Messenger transport and how many messages are waiting.
  • Shows the messages currently sitting on a transport (message id, message class and stamps), without consuming them.

It relies on Symfony Messenger's ListableReceiverInterface, so messages are only listable for transports that implement it (e.g. Doctrine, the in-memory transport, and Redis on recent Symfony versions). Transports that don't support listing (e.g. AMQP, SQS) are still shown, with a message count when the transport can provide one.

Requirements

  • PHP 8.1+
  • Symfony 6.4, 7.x or 8.x (symfony/messenger + symfony/twig-bundle)

Installation

composer require eurekos/symfony-messenger-monitor

If you don't use Symfony Flex, register the bundle manually in config/bundles.php:

return [
    // ...
    Eurekos\SymfonyMessengerMonitor\EurekosSymfonyMessengerMonitorBundle::class => ['all' => true],
];

Setup

This bundle ships an abstract controller. You enable the monitor by extending it in your own application: you choose the path prefix and the access control, and the routes are inherited from the base controller.

Create src/Controller/MessengerMonitorController.php:

namespace App\Controller;

use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Eurekos\SymfonyMessengerMonitor\Controller\MessengerMonitorController as BaseMessengerMonitorController;

#[Route('/admin/messenger')] // path prefix for the controllers
#[IsGranted('ROLE_ADMIN')]   // alternatively, protect it with a firewall
final class MessengerMonitorController extends BaseMessengerMonitorController
{
}

That's it. With the default Symfony route configuration (which loads attribute routes from src/Controller/), this registers:

Route name Path
eurekos_messenger_monitor_index /admin/messenger
eurekos_messenger_monitor_transport /admin/messenger/transport/{name}

The monitor is then available at /admin/messenger.

Notes

  • The base controller is autowired into your subclass automatically (it needs Twig and an internal transport service, both provided for you). You don't declare a constructor unless you want to.

  • Create exactly one subclass. The route names are defined on the base controller's actions, so several subclasses would clash.

  • Don't set a name: prefix on the class-level #[Route] attribute, otherwise the internal template links (which use the route names above) won't resolve.

  • If you prefer a firewall to #[IsGranted], drop the attribute and guard the prefix instead:

    # config/packages/security.yaml
    access_control:
        - { path: ^/admin/messenger, roles: ROLE_ADMIN }

This bundle adds no access control of its own; the queue can expose sensitive data, so always protect your route.

How it works

At compile time the bundle collects every service tagged messenger.receiver (that is how Symfony registers transports) into a service locator keyed by transport name. The controller then asks each receiver for its message count (MessageCountAwareInterface) and, when supported, lists pending envelopes (ListableReceiverInterface::all()).

License

MIT. See LICENSE.