-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
base: 2.4-develop
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -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> | ||
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 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 |
||
<item name="string" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\StringUtils</item> | ||
<item name="null" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\NullType</item> | ||
<item name="object" xsi:type="object">Magento\Framework\View\Layout\Argument\Interpreter\Passthrough</item> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Framework\Data\Argument\Interpreter; | ||
|
||
use Magento\Framework\Data\Argument\InterpreterInterface; | ||
|
||
/** | ||
* Interpreter of numeric data, such as integer or float | ||
*/ | ||
class Integer implements InterpreterInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* @return int|float | ||
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. Since you're returning an 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. Oh I thought this was new stuff, but clearly confused 😄 |
||
* @throws \InvalidArgumentException | ||
*/ | ||
public function evaluate(array $data) | ||
{ | ||
if (!isset($data['value']) || !is_numeric($data['value'])) { | ||
throw new \InvalidArgumentException('Numeric value is expected.'); | ||
} | ||
$result = $data['value']; | ||
return (int)$result; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,20 @@ public function __construct( | |
) { | ||
parent::__construct($reader, $cache, $cacheId, $serializer); | ||
} | ||
|
||
public function getQueues(): array { | ||
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. Since 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. cc: @paliarush |
||
return array_filter($this->get(),function($item){ | ||
if($item['type'] == 'queue'){ | ||
return $item; | ||
} | ||
}); | ||
} | ||
|
||
public function getExchanges(): array { | ||
return array_filter($this->get(),function($item){ | ||
if($item['type'] != 'queue'){ | ||
return $item; | ||
} | ||
}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ class FieldsTypes implements ValidatorInterface | |
public function validate($configData) | ||
{ | ||
foreach ($configData as $exchangeName => $exchangeConfig) { | ||
$this->validateFieldsTypes($exchangeName, $exchangeConfig); | ||
$exchangeConfig['type'] != 'queue' ? | ||
$this->validateFieldsTypes($exchangeName, $exchangeConfig) : $this->validateQueueTypes($exchangeName, $exchangeConfig); | ||
} | ||
} | ||
|
||
|
@@ -128,4 +129,16 @@ private function validateBindings($exchangeName, $exchangeConfig, $bindingFields | |
} | ||
} | ||
} | ||
|
||
/** | ||
* Make sure types of all fields in the queue item config are correct. | ||
* | ||
* @param string $queueName | ||
* @param array $queueConfig | ||
* @return void | ||
* @throws \LogicException | ||
*/ | ||
private function validateQueueTypes($queueName, $queueConfig) | ||
{ | ||
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. What validation should be provided here? |
||
} | ||
} |
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.
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