8000 [Messenger] Add `BeanstalkdPriorityStamp` to Beanstalkd bridge by HypeMC · Pull Request #59273 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Messenger] Add BeanstalkdPriorityStamp to Beanstalkd bridge #59273

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 8000 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
Jan 5, 2025

Conversation

HypeMC
Copy link
Contributor
@HypeMC HypeMC commented Dec 20, 2024
Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

Extracted from #49652 as the original PR was trying to do two separate things in one.

Beanstalkd has the ability to configure the priority at which messages are reserved. This can now be set using the BeanstalkdPriorityStamp:

$this->bus->dispatch(new SomeMessage('some data'), [
    new BeanstalkdPriorityStamp(0),
]);

final readonly class BeanstalkdPriorityStamp implements StampInterface
{
public function __construct(
public int $priority,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe?

Suggested change
public int $priority,
public readonly int $priority,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabpot No need, the class itself is readonly.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed :)

@fabpot
Copy link
Member
fabpot commented Jan 5, 2025

Thank you @HypeMC.

@fabpot fabpot merged commit 7d38047 into symfony:7.3 Jan 5, 2025
11 checks passed
@HypeMC HypeMC deleted the add-beanstalkdprioritystamp branch January 5, 2025 16:16
fabpot added a commit that referenced this pull request Feb 7, 2025
…bridge (HypeMC)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[Messenger] Add `bury_on_reject` option to Beanstalkd bridge

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

~~Contains #59273.~~

~~This PR adds two improvements to the Beanstalkd bridge:~~

1. Beanstalkd has the concept of "buried" jobs, which is a way of denoting that something has gone wrong while the consumer was processing the job. This PR adds a `bury_on_reject` option to bury rejected messages instead of deleting them, which is the current behavior. Since Symfony messenger's retry mechanism sends a new message for each retry and rejects the old one, it would create multiple buried jobs for each failed one. To avoid this issue a `SentForRetryStamp` was added to identify whether a failed message was sent for retry or not. As long as the retry mechanism keeps sending a new message, the old one will be deleted. Once it finishes, the final rejected message will be buried.

   ```yaml
   framework:
       messenger:
           transports:
               some_name:
                   dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                   options:
                       bury_on_reject: true
   ```

2. Extracted to #59273

Commits
-------

9f4b8a4 [Messenger] Add `bury_on_reject` option to Beanstalkd bridge
Spomky added a commit to Spomky/symfony-docs that referenced this pull request Feb 26, 2025
Adds explanation about the new `BeanstalkdPriorityStamp` introduced by symfony/symfony#59273
Fixes symfony#20513
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Feb 27, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[Messenger][Beanstalkd] Add Priority support

Adds explanation about the new `BeanstalkdPriorityStamp` introduced by symfony/symfony#59273.
 Fixes #20513.

Ping `@HypeMC` for the review.
Regards.

Commits
-------

63fc4e0 [Messenger] Priority support for Beanstalkd bridge
@fabpot fabpot mentioned this pull request May 2, 2025
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.

3 participants
0