-
-
Notifications
You must be signed in to change notification settings - Fork 504
Enable sync transport in messenger configuration #1464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tacman
wants to merge
1
commit into
symfony:main
Choose a base branch
from
tacman:patch-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Very little downside to enabling by default, as it's (almost) the same as not sending something through a transport at all.
|
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. symfony/messenger4.1 vs 4.3diff --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.html4.3 vs 5.4diff --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.0diff --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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Very little downside to enabling by default, as it's (almost) the same as not sending something through a transport at all.