-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add manage message queues instructions #5569
Changes from all commits
8dc0259
4b3c964
912e028
0446645
45bf9a3
342b6bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ functional_areas: | |||||
| Bulk API endpoints differ from other REST endpoints in that they combine multiple calls of the same type into an array and execute them as a single request. The endpoint handler splits the array into individual entities and writes them as separate messages to the message queue. | ||||||
|
|
||||||
| {:.bs-callout .bs-callout-tip} | ||||||
| Use the `bin/magento queue:consumers:start async.operations.all` command to enable bulk endpoint processing. | ||||||
| Use the `bin/magento queue:consumers:start async.operations.all` command to enable bulk endpoint processing, after configure the message queues. For more details see: [Manage message queues]({{ page.baseurl }}config-guide/mq/manage-message-queues.html). | ||||||
meker12 marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree on this point
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I edited the section above to include the information about RabbitMQ. The intent is to avoid having too many separate notes in the topic. |
||||||
|
|
||||||
| ### Routes | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -9,6 +9,12 @@ functional_areas: | |||
|
|
||||
| Bulk API endpoints differ from other REST endpoints in that they combine multiple calls of the same type into an array and execute them as a single request. The endpoint handler splits the array into individual entities and writes them as separate messages to the message queue. | ||||
|
|
||||
| {: .bs-callout .bs-callout-warning} | ||||
| By default, Magento uses RabbitMQ (AMQP) for processing message queues. Before using Bulk operations, you should see [RabbitMQ]({{ page.baseurl }}/install-gde/prereq/install-rabbitmq.html). | ||||
meker12 marked this conversation as resolved.
Show resolved
Hide resolved
meker12 marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest incorporating this information in the first note instead of having a second note immediately following the first note. |
||||
|
|
||||
| {:.bs-callout .bs-callout-info} | ||||
meker12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| Alternatively you can use CRON for processing message queues without RabbitMQ installed, see [Manage message queues]({{ page.baseurl }}/config-guide/mq/manage-message-queues.html). | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct me if I'm wrong, but I'm almost 100% convinced that cron should always be used, even if you use RabbitMQ, otherwise there won't be any consumers running and messages will only end up in the queue but will not get processed. The exception is if you use something like supervisor to manage consumers, but that has nothing to do with RabbitMQ vs MysqlMQ...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @hostep base on @rogyar previous explanation and first paragraph of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, that's what I mean by
😉 Anyway, just to make sure I know what I'm talking about, I just tested this again to be very sure, here are some graphs from the RabbitMQ management interface: Between 22:06 and 22:10, I send in 3 REST calls to the bulk endpoints. No cronjobs or message queue consumers were running at that time. Notice that messages are added to the queue but stay in there and aren't getting processed. At around 22:11, I executed a So using RabbitMQ by itself is not enough, you need consumers running within Magento so they can process the pending messages in the queue. Those consumers either get spawned using Magento's cronjob, you can start them manually using Is this enough information which you guys can use to fix all incorrect information on devdocs around this? Thanks! 🙂
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @hostep. I'll investigate it. Probably the misinformation is caused by de description of the Manage message queues that explains:
But at RabbitMQ explains that Crons are necessary to run consumers:
Probably the mistake is in the Manage message queues description that cause this confusion :(
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi there! Consumers can use RabbitMQ or the DB for messages. It depends on the implementation of the consumer.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brunoroeder I provided updated comments in the PR. If you can make the suggested changes, then we can merge this PR. Short story: Make suggested edits to note referring to start:consumers command, and remove note about RabbitMQ. Let me know if you have any questions. Thx.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Its not now. CRON really still CAN be used. But you can also disable your consumer to run by using cron. And them align your server to run consumer as a service, without basically letting Magento know that its running. So Cronjob is really optional on this step, same us direct running on consumer process. This decision is up to developers
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @nuzil, thanks for the feedback! I agree with your comment, sorry that was a bad wording from me. This is not the case. You need a place to store the messages (RabbitMQ or MysqlMQ) and consumer processes to do something with those messages. You need both, one of them by itself is not going to work. For bulk api, you always need RabbitMQ (at the moment of writing) and using cronjobs as an alternative makes no sense. The cronjob which is being referred to here, is the You are correct that cronjobs aren't necessary to spawn consumer processes, you can manually run them or have some other system manage them. But you do need consumer processes running to have the messages being processed. I already tried to explain it a bit better previously a bit higher up, let me quote myself:
I'm not seeing ghosts right? I did test this many times now already ... 🙂
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I guess I skip this part of your message :-)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I would leave it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hostep and @nuzil Looking at an issue opened in Magento code repo: magento/magento2#25142 (comment) In that issue, it looks like customer gets an error if they don't use RabbitMQ with Bulk API. Adding the note about using alternatives for processing message seems to add confusion. Even if it is possible to use something besides RabbitMQ to process messages with the Bulk API, isn't the advantage of the Bulk API is that it is pre-configured with the functionality that you need? My suggestion is to delete the "Alternatively, you can use ... " note from this topic for now. And to provide information about the custom configuration that does not use RabbitMQ as a separate topic, perhaps a KB article or blog. That is assuming that the best practice and easiest way to process message queues using the Bulk API is to use the default configuration with RabbitMQ as the message broker. Additionally, after we close this PR, it might be helpful to update the Bulk API tutorial to include RabbitMQ configuration in the Before you begin section. |
||||
|
|
||||
| {:.bs-callout .bs-callout-tip} | ||||
| Use the `bin/magento queue:consumers:start async.operations.all` command to enable bulk endpoint processing. | ||||
|
|
||||
|
|
||||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.