Skip to content
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

[Messenger] document reset_on_message transport option #15796

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Sep 10, 2021

fabpot added a commit to symfony/symfony that referenced this pull request Sep 10, 2021
… between 2 messages (lyrixx)

This PR was merged into the 5.4 branch.

Discussion
----------

[Mesenger] Add support for reseting container services between 2 messages

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | symfony/symfony-docs#15796

Without this patch, services are not resetted. For example Monolog
Finger Cross handler is never reset nor flushed. So if the first
message trigger and "error" level message, all others message will log
and overflow the buffer.

So, when a transport is **async** (it means it is run in a worker), it's highly preferable to this configuration on

Usage with framework:

```yaml
framework:
    messenger:
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                reset_on_message: true
            failed: 'doctrine://default?queue_name=failed'
            sync: 'sync://'
```

Commits
-------

488bb88 [Mesenger] Add support for resetting container services after each messenger message.
messenger.rst Outdated Show resolved Hide resolved
messenger.rst Show resolved Hide resolved
messenger.rst Show resolved Hide resolved
messenger.rst Outdated Show resolved Hide resolved
messenger.rst Outdated Show resolved Hide resolved
@OskarStark OskarStark added this to the 5.4 milestone Sep 11, 2021
@lyrixx
Copy link
Member Author

lyrixx commented Sep 15, 2021

@OskarStark & @94noni thanks for the review. I have addressed your comments.

messenger.rst Outdated Show resolved Hide resolved
@javiereguiluz
Copy link
Member

Thanks Grég for this nice contribution! I did some minor rewords while merging, but the core of your contribution remained. Cheers!

@lyrixx lyrixx deleted the messenger-reset branch October 4, 2021 13:51
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.

None yet

5 participants