Skip to content

Commit 4f2848b

Browse files
committed
MCP-826: Use RabbitMQ for all consumers if AMQP is set in deployment config
- Print test server queue configuration;
1 parent 564e139 commit 4f2848b

File tree

2 files changed

+17
-5
lines changed
  • app/code/Magento/WebapiAsync/Code/Generator/Config/RemoteServiceReader
  • dev/tests/integration/testsuite/Magento/ImportExport/Model/Export

2 files changed

+17
-5
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,39 @@
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
1517
*/
1618
class Publisher implements \Magento\Framework\Config\ReaderInterface
1719
{
18-
1920
/**
2021
* @var WebApiAsyncConfig
2122
*/
2223
private $webapiAsyncConfig;
2324

25+
/**
26+
* Default value provider.
27+
*
28+
* @var DefaultValueProvider
29+
*/
30+
private $defaultValueProvider;
31+
2432
/**
2533
* Initialize dependencies.
2634
*
2735
* @param WebApiAsyncConfig $webapiAsyncConfig
36+
* @param DefaultValueProvider|null $defaultValueProvider
2837
*/
2938
public function __construct(
30-
WebApiAsyncConfig $webapiAsyncConfig
39+
WebApiAsyncConfig $webapiAsyncConfig,
40+
DefaultValueProvider $defaultValueProvider = null
3141
) {
3242
$this->webapiAsyncConfig = $webapiAsyncConfig;
43+
$this->defaultValueProvider = $defaultValueProvider
44+
?? ObjectManager::getInstance()->get(DefaultValueProvider::class);
3345
}
3446

3547
/**
@@ -50,8 +62,8 @@ public function read($scope = null)
5062
'topic' => $topicName,
5163
'disabled' => false,
5264
'connections' => [
53-
'amqp' => [
54-
'name' => 'amqp',
65+
$this->defaultValueProvider->getConnection() => [
66+
'name' => $this->defaultValueProvider->getConnection(),
5567
'exchange' => 'magento',
5668
'disabled' => false,
5769
],

dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/ConsumerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function tearDown(): void
8989
*/
9090
public function testProcess(): void
9191
{
92-
$this->objectManager->get('Psr\Log\LoggerInterface')->info('Amqp config ' . implode(" ", $this->deploymentConfig->get('queue/amqp')));
92+
echo "Deployment config for queue is: " . json_encode($this->deploymentConfig->get('queue'));
9393
$envelope = $this->queue->dequeue();
9494
$decodedMessage = $this->messageEncoder->decode('import_export.export', $envelope->getBody());
9595
$this->consumer->process($decodedMessage);

0 commit comments

Comments
 (0)