Skip to content

Commit 2e8e866

Browse files
committed
B2B-2171: Enable WebapiAsync work with redis connection
1 parent 67ee5ff commit 2e8e866

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

app/code/Magento/WebapiAsync/Code/Generator/Config/RemoteServiceReader/Publisher.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
namespace Magento\WebapiAsync\Code\Generator\Config\RemoteServiceReader;
1010

1111
use Magento\AsynchronousOperations\Model\ConfigInterface as WebApiAsyncConfig;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\MessageQueue\DefaultValueProvider;
1214

1315
/**
1416
* Remote service reader with auto generated configuration for queue_publisher.xml
@@ -20,15 +22,26 @@ class Publisher implements \Magento\Framework\Config\ReaderInterface
2022
*/
2123
private $webapiAsyncConfig;
2224

25+
/**
26+
* Default value provider.
27+
*
28+
* @var DefaultValueProvider
29+
*/
30+
private $defaultValueProvider;
31+
2332
/**
2433
* Initialize dependencies.
2534
*
2635
* @param WebApiAsyncConfig $webapiAsyncConfig
36+
* @param DefaultValueProvider|null $defaultValueProvider
2737
*/
2838
public function __construct(
29-
WebApiAsyncConfig $webapiAsyncConfig
39+
WebApiAsyncConfig $webapiAsyncConfig,
40+
DefaultValueProvider $defaultValueProvider = null
3041
) {
3142
$this->webapiAsyncConfig = $webapiAsyncConfig;
43+
$this->defaultValueProvider = $defaultValueProvider
44+
?? ObjectManager::getInstance()->get(DefaultValueProvider::class);
3245
}
3346

3447
/**
@@ -49,8 +62,8 @@ public function read($scope = null)
4962
'topic' => $topicName,
5063
'disabled' => false,
5164
'connections' => [
52-
'amqp' => [
53-
'name' => 'amqp',
65+
$this->defaultValueProvider->getConnection() => [
66+
'name' => $this->defaultValueProvider->getConnection(),
5467
'exchange' => 'magento',
5568
'disabled' => false,
5669
],

app/code/Magento/WebapiAsync/etc/queue_consumer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
10-
<consumer name="async.operations.all" queue="async.operations.all" connection="amqp"
10+
<consumer name="async.operations.all" queue="async.operations.all"
1111
consumerInstance="Magento\AsynchronousOperations\Model\MassConsumer"/>
1212
</config>

app/code/Magento/WebapiAsync/etc/queue_topology.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
9-
<exchange name="magento" connection="amqp">
9+
<exchange name="magento">
1010
<binding id="async.operations.all" topic="async.#" destination="async.operations.all"/>
1111
</exchange>
1212
</config>

0 commit comments

Comments
 (0)