Skip to content

[Messenger] Don't prevent dispatch out of another bus #37976

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
merged 1 commit into from
Sep 10, 2020
Merged

[Messenger] Don't prevent dispatch out of another bus #37976

merged 1 commit into from
Sep 10, 2020

Conversation

ogizanagi
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets #35814 (comment)
License MIT
Doc PR N/A


return $envelope;
$envelope = $envelope->withoutAll(DispatchAfterCurrentBusStamp::class);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing it from the envelope makes sense to me here for two reasons:

  • even if it was explicitly configured with this stamp, it was not handled "transactionally". The userland bus might add it automatically by design and won't care about the context. So the stamp being present after the dispatch in the profiler might be confusing for the user.
  • some logic could exist for messages dispatched transactionally with this stamp. Removing it in the case it was handled directly will prevent triggering such logic unexpectedly.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I would love to get some input from @Nyholm and/or @weaverryan

@Nyholm
Copy link
Member

Nyholm commented Aug 30, 2020

Thank you for the PR.

Im hesitant. I do like the fact that this will make testing of my command handlers simpler because the command handler dispatches events with the DispatchAfterCurrentBusStamp. Now I don't need to invoke a dummy command bus that invoke my handlers, I can invoke my command handlers directly.

However, when running production code (non-test), I don't see any scenario where you would like to add a DispatchAfterCurrentBusStamp when you are not on a "current bus". So I dont think this change make any sense.

With that said tough... If the stamp was named something differently. Like (not a suggestion) DispatchMessageInTheirOwnSeparateBusTransaction, then yes. I guess this would make perfect sense. =)

It also seams like @ostrolucky and @jkobus are dispatching these events from non-message handlers. That is something I would never do =). But I guess they have their reasons why it makes sense for them. So Im not sure I would fight them on a principle...


This answer was very undeceive. Sorry about that..

  • I do like the implementation.
  • I don't like the reason why we need this
  • I do like that this makes things easier for developers (myself included)
  • I maybe just feel that merging this will result to a weird name of the stamp, but I don't suggest changing it.

I can really go either way with this PR. @weaverryan what are your thoughts?

@nicolas-grekas nicolas-grekas added this to the next milestone Aug 31, 2020
@fabpot
Copy link
Member

fabpot commented Sep 10, 2020

Based on @Nyholm's comment, I'm merging it. Maybe another PR could change the name.

@fabpot
Copy link
Member

fabpot commented Sep 10, 2020

Thank you @ogizanagi.

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

Successfully merging this pull request may close these issues.

5 participants