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] Messenger: custom consumer name with systemd #19699

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

maxxer
Copy link
Contributor

@maxxer maxxer commented Mar 22, 2024

No description provided.

@wouterj
Copy link
Member

wouterj commented Jun 27, 2024

Hi! Can you please explain why this env var is needed and where it is used?

Searching through the Symfony code for this env var, I cannot find it: https://github.com/search?q=repo%3Asymfony%2Fsymfony%20MESSENGER_CONSUMER_NAME&type=code

@DubbleClick
Copy link

https://symfony.com/doc/current/messenger.html#supervisor-configuration

If you use the Redis Transport, note that each worker needs a unique consumer name to avoid the same message being handled by multiple workers. One way to achieve this is to set an environment variable in the Supervisor configuration file, which you can then refer to in messenger.yaml (see the ref:Redis section <messenger-redis-transport> below):

environment=MESSENGER_CONSUMER_NAME=%(program_name)s_%(process_num)02d

@javiereguiluz javiereguiluz added this to the 6.4 milestone Feb 3, 2025
@carsonbot carsonbot changed the title Messenger: custom consumer name with systemd [Messenger] Messenger: custom consumer name with systemd Feb 3, 2025
@javiereguiluz javiereguiluz changed the base branch from 7.0 to 6.4 February 3, 2025 12:35
@javiereguiluz javiereguiluz merged commit a9fb4d5 into symfony:6.4 Feb 3, 2025
3 checks passed
@javiereguiluz
Copy link
Member

Lorenzo, thanks for this contribution and congrats on your first Symfony Docs contribution 🎉 Sorry it took us so long to merge this.

@maxxer maxxer deleted the patch-1 branch February 3, 2025 12:37
@aggrrrh
Copy link

aggrrrh commented Feb 15, 2025

Hi! Can you please explain why this env var is needed and where it is used?

Searching through the Symfony code for this env var, I cannot find it: https://github.com/search?q=repo%3Asymfony%2Fsymfony%20MESSENGER_CONSUMER_NAME&type=code

I think you are right. There is no mention of it in the code. But the documentation states that:

If you run multiple queue workers, consumer can be set to an environment variable, like %env(MESSENGER_CONSUMER_NAME)%, set by Supervisor (example below) or any other service used to manage the worker processes.

and it's not clear that the consumer option must be configured to use this environment variable to function properly.

@aggrrrh
Copy link

aggrrrh commented Feb 15, 2025

#20656

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.

6 participants