-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Adding the "sync" transport to call handlers synchronously #30759
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
Merged
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
01670b2
to
3da5a43
Compare
This was referenced Mar 28, 2019
OskarStark
reviewed
Mar 29, 2019
@@ -4,6 +4,8 @@ CHANGELOG | |||
4.3.0 | |||
----- | |||
|
|||
* Added a new `SyncTransport` along with `ForceCallHandlersStamp` to | |||
explicitly handle messages asynchronously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/asynchronously/synchronously/ ?
fabpot
approved these changes
Mar 29, 2019
Thank you @weaverryan. |
fabpot
added a commit
that referenced
this pull request
Mar 30, 2019
…rs synchronously (weaverryan) This PR was merged into the 4.3-dev branch. Discussion ---------- [Messenger] Adding the "sync" transport to call handlers synchronously | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | symfony/symfony-docs#11236 This adds a `sync://` transport that just calls the handlers immediately. Why? This allows you to route your messages to some "async" transport. But then, when developing locally or running your tests, you can choose to run them synchronously instead: ```yml # config/packages/messenger.yaml framework: messenger: transports: async: '%env(MESSENGER_TRANSPORT_DSN)%' routing: 'App\Message\SmsNotification': async 'App\Message\OtherMessage': async ``` ``` # .env # by default, handle this sync MESSENGER_TRANSPORT_DSN=sync:// ``` ``` # .env.local on production (or set this via real env vars) # on production, use amqp MESSENGER_TRANSPORT_DSN=amqp://....... ``` Cheers! Commits ------- 3da5a43 Adding the "sync" transport to call handlers synchronously
Merged
fabpot
added a commit
that referenced
this pull request
May 11, 2019
…ed with SyncTransport (Tobion) This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] remove send_and_handle which can be achieved with SyncTransport | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | yes/no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | yes <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | symfony/symfony-docs#11236 The send_and_handle option is pretty awkward and we don't need it anymore because the same thing can be achieved with the SyncTransport from #30759 So the following example from the doc in https://symfony.com/doc/current/messenger.html#routing ```yaml framework: messenger: routing: 'My\Message\ThatIsGoingToBeSentAndHandledLocally': senders: [amqp] send_and_handle: true ``` is the same as ```yaml framework: messenger: routing: 'My\Message\ThatIsGoingToBeSentAndHandledLocally': senders: [amqp, sync] ``` #31401 (review) Commits ------- 4552b7f [Messenger] remove send_and_handle option which can be achieved with SyncTransport
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.
This adds a
sync://
transport that just calls the handlers immediately. Why? This allows you to route your messages to some "async" transport. But then, when developing locally or running your tests, you can choose to run them synchronously instead:Cheers!