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

[MessageQueue]: add support for first class queue configuration. #30111

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from

Conversation

Nolan-Arnold
Copy link

Co-authored-by: Damien Retzinger damienwebdev@gmail.com

Description (*)

The Message Broker, RabbitMQ, supports arguments that are defined at queue creation time that dictate certain behaviors of the resulting queue. Currently (as of v2.4.0), Magento infers what queues will be created from properties of the exchange.binding defined in any given module's queue_topology.xml.

Unfortunately, the current implementation of queue_topology.xml does not expose a queue object to specify arguments at queue creation time, preventing utilization of the configurable behavior of RabbitMQ queues.

Related Pull Requests

https://github.com/magento/architecture/pull/432/files

Manual testing scenarios (*)

https://github.com/magento/architecture/blob/master/design-documents/message-queue/first-class-queue-configuration.md#sample-configurations

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)
  • All automated tests passed successfully (all builds are green)

CC: @damienwebdev @nrkapoor @paliarush @nuzil @maghamed

@m2-assistant
Copy link

m2-assistant bot commented Sep 18, 2020

Hi @Nolan-Arnold. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ 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

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Sep 18, 2020

Hi @Nolan-Arnold, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost removed this from Pending Review in Pull Requests Dashboard Sep 18, 2020
@Nolan-Arnold Nolan-Arnold reopened this Sep 18, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 18, 2020

Hi @Nolan-Arnold. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ 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

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@ghost ghost added this to Pending Review in Pull Requests Dashboard Sep 18, 2020
$autoDelete = $this->getAttributeValue($exchange, 'autoDelete', false);
$result[$name . '--' . $connection] = [
'name' => $name,
'type' => $this->getAttributeValue($exchange, 'type'),
Copy link
Member

Choose a reason for hiding this comment

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

Given that we're inside a loop over the queues, this property can be inferred without the extra attribute on the config node, correct?

@@ -256,6 +256,7 @@
<item name="array" xsi:type="object">arrayArgumentInterpreterProxy</item>
<item name="boolean" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Boolean</item>
<item name="number" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Number</item>
<item name="int" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Integer</item>
Copy link
Member

Choose a reason for hiding this comment

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

I don't precisely know the full scope of how why this interpreter injection seems to occur in various hierarchies, but potentially this isn't in the scope of this PR?

cc: @paliarush

@@ -479,6 +479,7 @@
<item name="array" xsi:type="object">layoutArrayArgumentReaderInterpreterProxy</item>
<item name="boolean" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Boolean</item>
<item name="number" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Number</item>
<item name="int" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Integer</item>
Copy link
Member

Choose a reason for hiding this comment

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

I don't precisely know the full scope of how why this interpreter injection seems to occur in various hierarchies, but potentially this isn't in the scope of this PR?

cc: @paliarush

@@ -23,4 +23,20 @@ public function __construct(
) {
parent::__construct($reader, $cache, $cacheId, $serializer);
}

public function getQueues(): array {
Copy link
Member

Choose a reason for hiding this comment

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

Since ->get() loses backward compatibility (it returns both exchanges and queues when it used to only return exchanges), how should we consider the compatibility of this API?

Copy link
Member

Choose a reason for hiding this comment

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

* @throws \LogicException
*/
private function validateQueueTypes($queueName, $queueConfig)
{
Copy link
Member

Choose a reason for hiding this comment

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

What validation should be provided here?

foreach ($diff as $field) {
$errors[] = sprintf('Missing [%s] field for binding %s in exchange config.', $field, $name);
$errors[] = sprintf('Really Missing [%s] field for queue %s.', $field, $name);
Copy link
Member

Choose a reason for hiding this comment

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

@Nolan-Arnold is the emphatic Really necessary?

@@ -99,6 +99,41 @@ public function convert($source)
'arguments' => $exchangeArguments,
];
}

foreach ($source->getElementsByTagName('queue') as $exchange) {
Copy link
Member

Choose a reason for hiding this comment

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

$exchange should be $queue

@sidolov sidolov added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Sep 21, 2020
@nuzil
Copy link
Contributor

nuzil commented Mar 23, 2021

Hey @Nolan-Arnold are you still working on this? Can you check comments and also backmerge 2.4 into your branch?

@nuzil nuzil self-requested a review March 23, 2021 15:50
{
/**
* {@inheritdoc}
* @return int|float
Copy link
Member

Choose a reason for hiding this comment

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

Since you're returning an int, the return value should just be int right?

Copy link
Member

Choose a reason for hiding this comment

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

Oh I thought this was new stuff, but clearly confused 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: App Component: Data Component: MessageQueue Component: Ui Priority: P3 May be fixed according to the position in the backlog. Progress: review Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Pull Requests Dashboard
  
Review in Progress
Development

Successfully merging this pull request may close these issues.

None yet

6 participants