Skip to content

Conversation

@tacman
Copy link
Contributor

@tacman tacman commented Oct 17, 2025

Very little downside to enabling by default, as it's (almost) the same as not sending something through a transport at all.

Q A
License MIT
Doc issue/PR symfony/symfony#62097

Very little downside to enabling by default, as it's (almost) the same as not sending something through a transport at all.
@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) October 17, 2025 18:45
@github-actions
Copy link

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1464/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1464/index.json
  2. Install the package(s) related to this recipe:

    composer req symfony/flex
    composer req 'symfony/messenger:^6.0'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

symfony/messenger

4.1 vs 4.3
diff --git a/symfony/messenger/4.1/config/packages/messenger.yaml b/symfony/messenger/4.3/config/packages/messenger.yaml
index c8078980..6b7319ce 100644
--- a/symfony/messenger/4.1/config/packages/messenger.yaml
+++ b/symfony/messenger/4.3/config/packages/messenger.yaml
@@ -1,9 +1,14 @@
 framework:
     messenger:
+        # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
+        # failure_transport: failed
+
         transports:
-            # Uncomment the following line to enable a transport named "amqp"
-            # amqp: '%env(MESSENGER_TRANSPORT_DSN)%'
+            # https://symfony.com/doc/current/messenger.html#transport-configuration
+            # async: '%env(MESSENGER_TRANSPORT_DSN)%'
+            # failed: 'doctrine://default?queue_name=failed'
+            # sync: 'sync://'
 
         routing:
             # Route your messages to the transports
-            # 'App\Message\YourMessage': amqp
+            # 'App\Message\YourMessage': async
diff --git a/symfony/messenger/4.1/manifest.json b/symfony/messenger/4.3/manifest.json
index d0ff1732..dc045158 100644
--- a/symfony/messenger/4.1/manifest.json
+++ b/symfony/messenger/4.3/manifest.json
@@ -3,10 +3,13 @@
         "config/": "%CONFIG_DIR%/"
     },
     "env": {
-        "#1": "MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages"
+        "#1": "Choose one of the transports below",
+        "#2": "MESSENGER_TRANSPORT_DSN=doctrine://default",
+        "#3": "MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages",
+        "#4": "MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages"
     },
     "aliases": ["messenger"],
     "conflict": {
-        "symfony/framework-bundle": "<4.1"
+        "symfony/framework-bundle": "<4.3"
     }
 }
diff --git a/symfony/messenger/4.1/post-install.txt b/symfony/messenger/4.3/post-install.txt
index 6a2c8ade..8844fe7a 100644
--- a/symfony/messenger/4.1/post-install.txt
+++ b/symfony/messenger/4.3/post-install.txt
@@ -1,13 +1,11 @@
   * You're ready to use the Messenger component. You can define your own message buses
-    or start using the default one right now by injecting the messenger.bus.default service
-    or typehinting Symfony\Component\Messenger\MessageBusInterface in your code.
+    or start using the default one right now by injecting the message_bus service
+    or type-hinting Symfony\Component\Messenger\MessageBusInterface in your code.
 
-  * If you need to send messages to your broker, you can benefit from the built-in
-    AMQP transport by:
+  * To send messages to a transport and handle them asynchronously:
 
-    1. Installing the AMQP pack by running composer require amqp;
-    2. Uncommenting the MESSENGER_TRANSPORT_DSN env var
-       and framework.messenger.transports.amqp config;
-    3. Routing your messages to the amqp sender.
+    1. Uncomment the MESSENGER_TRANSPORT_DSN env var in .env
+       and framework.messenger.transports.async in config/packages/messenger.yaml;
+    2. Route your message classes to the async transport in config/packages/messenger.yaml.
 
-  * Read the documentation at https://symfony.com/doc/master/messenger.html
+  * Read the documentation at https://symfony.com/doc/current/messenger.html
4.3 vs 5.4
diff --git a/symfony/messenger/4.3/config/packages/messenger.yaml b/symfony/messenger/5.4/config/packages/messenger.yaml
index 6b7319ce..ce25a11f 100644
--- a/symfony/messenger/4.3/config/packages/messenger.yaml
+++ b/symfony/messenger/5.4/config/packages/messenger.yaml
@@ -1,5 +1,8 @@
 framework:
     messenger:
+        # reset services after consuming messages
+        reset_on_message: true
+
         # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
         # failure_transport: failed
 
diff --git a/symfony/messenger/4.3/manifest.json b/symfony/messenger/5.4/manifest.json
index dc045158..793ce278 100644
--- a/symfony/messenger/4.3/manifest.json
+++ b/symfony/messenger/5.4/manifest.json
@@ -4,9 +4,9 @@
     },
     "env": {
         "#1": "Choose one of the transports below",
-        "#2": "MESSENGER_TRANSPORT_DSN=doctrine://default",
-        "#3": "MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages",
-        "#4": "MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages"
+        "#2": "MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages",
+        "#3": "MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages",
+        "MESSENGER_TRANSPORT_DSN": "doctrine://default?auto_setup=0"
     },
     "aliases": ["messenger"],
     "conflict": {
5.4 vs 6.0
diff --git a/symfony/messenger/5.4/config/packages/messenger.yaml b/symfony/messenger/6.0/config/packages/messenger.yaml
index ce25a11f..19db483d 100644
--- a/symfony/messenger/5.4/config/packages/messenger.yaml
+++ b/symfony/messenger/6.0/config/packages/messenger.yaml
@@ -1,8 +1,5 @@
 framework:
     messenger:
-        # reset services after consuming messages
-        reset_on_message: true
-
         # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
         # failure_transport: failed
 
@@ -10,8 +7,16 @@ framework:
             # https://symfony.com/doc/current/messenger.html#transport-configuration
             # async: '%env(MESSENGER_TRANSPORT_DSN)%'
             # failed: 'doctrine://default?queue_name=failed'
-            # sync: 'sync://'
+            sync: 'sync://'
 
         routing:
             # Route your messages to the transports
             # 'App\Message\YourMessage': async
+
+# when@test:
+#    framework:
+#        messenger:
+#            transports:
+#                # replace with your transport name here (e.g., my_transport: 'in-memory://')
+#                # For more Messenger testing tools, see https://github.com/zenstruck/messenger-test
+#                async: 'in-memory://'
diff --git a/symfony/messenger/5.4/post-install.txt b/symfony/messenger/6.0/post-install.txt
index 8844fe7a..186bec8a 100644
--- a/symfony/messenger/5.4/post-install.txt
+++ b/symfony/messenger/6.0/post-install.txt
@@ -4,8 +4,10 @@
 
   * To send messages to a transport and handle them asynchronously:
 
-    1. Uncomment the MESSENGER_TRANSPORT_DSN env var in .env
+    1. Update the MESSENGER_TRANSPORT_DSN env var in .env if needed
        and framework.messenger.transports.async in config/packages/messenger.yaml;
-    2. Route your message classes to the async transport in config/packages/messenger.yaml.
+    2. (if using Doctrine) Generate a Doctrine migration bin/console doctrine:migration:diff
+       and execute it bin/console doctrine:migration:migrate
+    3. Route your message classes to the async transport in config/packages/messenger.yaml.
 
   * Read the documentation at https://symfony.com/doc/current/messenger.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant