Documentation for Retries & Failures

Created on 6 July 2025, about 1 month ago

Pad out README with basic info to customise retries and failures

https://symfony.com/doc/current/messenger.html#retries-failures

📌 Task
Status

Active

Version

1.0

Component

Documentation

Created by

🇦🇺Australia dpi Perth, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dpi
  • 🇦🇺Australia dpi Perth, Australia

    Since this mentions the retry/failed commands, it should be merged after https://git.drupalcode.org/project/sm/-/merge_requests/35

  • 🇦🇺Australia dpi Perth, Australia

    The docs also mention `sm messenger:failed:retry` command, which has not been implemented. In a MR or not.

    Set to review to gather feedback on the MR in the meantime.

  • 🇦🇺Australia dpi Perth, Australia
  • 🇦🇺Australia dpi Perth, Australia
  • 🇵🇱Poland sandboxpl Poland 🇵🇱

    I am testing it with 1.x-dev version of the module + 2.0.0-alpha4 version of symfony_mailer module.
    After setting up following YAML:

    parameters:
      sm.default_bus: sm.bus.default
      sm.buses:
        default:
          middleware: [ ]
          default_middleware:
            enabled: true
        event:
          middleware: [ ]
          default_middleware:
            enabled: true
      sm.routing:
        Symfony\Component\Mailer\Messenger\SendEmailMessage: asynchronous
        '*': synchronous
      sm.failure_transport: 'failed'
    

    I can see that my failed messages are retried for 3 times and then they land in the failed queue. For testing I am just sending emails via SMTP transport with incorrect hostname.
    I am also looking at usign different transport provided by sm_transport_doctrine module but this does not seem to work, and I can't find a way to configure it, is it correct that doctrine module won't support this functionality atm?

  • 🇦🇺Australia dpi Perth, Australia

    @sandboxpl

    I am also looking at usign different transport provided by sm_transport_doctrine module but this does not seem to work, and I can't find a way to configure it, is it correct that doctrine module won't support this functionality atm?

    Transports shouldnt have to do anything to support failed functionality.

    You just need to make sure the failed transport itself is pointing to the one you want.

    SM has

    sm.transports
        failed:
          dsn: 'drupal-sql://default?queue_name=failed'
    

    So you just need to make sure your transports are re-defined it in your custom services.yml file, where the DSN is a doctrine:// protocol, not the new drupal-sql:// protocol.

    Please keep us updated with your progress, it helps a lot.

  • 🇦🇺Australia dpi Perth, Australia

    Should be something like

    parameters:
      symfony_messenger_doctrine.transports:
        # Automatically create a Doctrine transport named 'doctrine'.
        # Override this to disable or add more.
        doctrine:
          dsn: 'doctrine://default?auto_setup=true'
          options: []
        failed:
          dsn: 'doctrine://default?auto_setup=true&queue_name=failed'
          options: []
    

    Or more verbose:

    parameters:
      symfony_messenger_doctrine.transports:
        # Automatically create a Doctrine transport named 'doctrine'.
        # Override this to disable or add more.
        doctrine:
          dsn: 'doctrine://default?auto_setup=true'
          options: []
          failure_transport: doctrine_failed
        doctrine_failed:
          dsn: 'doctrine://default?auto_setup=true&queue_name=failed'
          options: []
    
Production build 0.71.5 2024