8000 [Messenger][Beanstalkd] Add Priority support by Spomky · Pull Request #20696 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Messenger][Beanstalkd] Add Priority support #20696

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
23 changes: 23 additions & 0 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,29 @@

Keepalive support, using the ``--keepalive`` option, was added in Symfony 7.2.

When using the Beanstalkd transport in Symfony Messenger, you can now set the priority of the messages being dispatched.
This allows you to control the order in which the messages are processed, with lower values indicating higher priority.

To configure the priority, use the ``Symfony\Component\Messenger\Bridge\Beanstalkd\Transport\BeanstalkdPriorityStamp``
when dispatching a message:

.. code-block:: php

Check failure on line 1798 in messenger.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please do not use ".. code-block:: php", use "::" instead.
8000
Comment on lines +1796 to +1798
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
when dispatching a message:
.. code-block:: php
when dispatching a message::

Copy link
Member

Choose a reason for hiding this comment

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

Fixed while merging.


use App\Message\SomeMessage;
use Symfony\Component\Messenger\Stamp\BeanstalkdPriorityStamp;

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

As defined by the Beanstalkd protocol, the priority value must be an integer between 0 (highest priority) and 2**32 (lowest priority).
Copy link
Contributor
@HypeMC HypeMC Feb 27, 2025

Choose a reason for hiding this comment

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

Actually, according to the specification:

  • is an integer < 2**32.

So the lowest number is 2**32 - 1.


If no priority is specified, the default value ``1024`` will be used.

.. versionadded:: 7.3

``BeanstalkdPriorityStamp`` support was added in Symfony 7.3.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
``BeanstalkdPriorityStamp`` support was added in Symfony 7.3.
``BeanstalkdPriorityStamp`` support was introduced in Symfony 7.3.

Copy link
Member

Choose a reason for hiding this comment

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

Done while merging.


.. _messenger-redis-transport:

Redis Transport
Expand Down
0