magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Message Queue Changes Tracking in `setup:db:status` Command

Open ajith107 opened this issue 10 months ago • 6 comments

Description (*)

  • Message Queue changes is getting tracked in the setup:db:status command

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes https://github.com/magento/magento2/issues/38225

Manual testing scenarios (*)

  1. Introduced a new queue using queue_consumer.xml and verify that setup:db:status returning setup:upgrade needed message
  2. Run the unit test and verified that all the tests are passed

Questions or comments

Contribution checklist (*)

  • [ ] Pull request has a meaningful description of its purpose
  • [ ] All commits are accompanied by meaningful commit messages
  • [ ] All new or changed code is covered with unit/integration tests (if applicable)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

ajith107 avatar Mar 04 '25 06:03 ajith107

Hi @ajith107. Thank you for your contribution! Here are some useful tips on how you can test your changes using Magento test environment. :exclamation: Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s) For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar Mar 04 '25 06:03 m2-assistant[bot]

@magento run all tests

ajith107 avatar Mar 04 '25 06:03 ajith107

I believe it's suboptimal to update this command with db unrelated stuff. As an alternative you can introduce new setup::amgp:statuscommand

kandy avatar Mar 04 '25 20:03 kandy

I like the idea behind this but there are 2, non insurmountable, flaws in its design.

1: The MysqlMQ model reads from topology not consumer when running through setup:upgrade so you could miss a queue or 2 (practically not an issue if no consumer really). You could update to using use Magento\Framework\MessageQueue\Topology\Config\CompositeReader;

2: Queues don't get deleted from the queue table, so once a queue is removed from the code base for any reason, the command would always come back as out of date. You could get by this by switching from a === to a diff of read vs db queues and checking if empty as you would be only looking for new queues being missing.

furan917 avatar Nov 01 '25 17:11 furan917

I made a quick module for anyone to use in the midterm if they wish to get the benefits of checking for new queues. And shows off how I tackled the 2 above points.

https://github.com/furan917/Magento2-QueueConfigStatus

Thank you @carlos-reynosa, I would not have seen this if you had not tagged it in your Deployer PR

furan917 avatar Nov 01 '25 17:11 furan917

@magento run all tests

engcom-Hotel avatar Dec 04 '25 05:12 engcom-Hotel