Skip to content

Commit e1035cd

Browse files
committed
MCP-826: Use RabbitMQ for all consumers if AMQP is set in deployment config
- Add new default_connection option for setup:config:set;
1 parent 99ddc33 commit e1035cd

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

app/code/Magento/MessageQueue/Setup/ConfigOptionsList.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\App\DeploymentConfig;
1313
use Magento\Framework\Config\Data\ConfigData;
1414
use Magento\Framework\Config\File\ConfigFilePool;
15+
use Magento\Framework\Setup\Option\TextConfigOption;
1516

1617
/**
1718
* Deployment configuration consumers options needed for Setup application
@@ -22,16 +23,19 @@ class ConfigOptionsList implements ConfigOptionsListInterface
2223
* Input key for the option
2324
*/
2425
const INPUT_KEY_QUEUE_CONSUMERS_WAIT_FOR_MESSAGES ='consumers-wait-for-messages';
26+
const INPUT_KEY_QUEUE_DEFAULT_CONNECTION ='default-connection';
2527

2628
/**
27-
* Path to the value in the deployment config
29+
* Path to the values in the deployment config
2830
*/
2931
const CONFIG_PATH_QUEUE_CONSUMERS_WAIT_FOR_MESSAGES = 'queue/consumers_wait_for_messages';
32+
const CONFIG_PATH_QUEUE_DEFAULT_CONNECTION = 'queue/default_connection';
3033

3134
/**
3235
* Default value
3336
*/
3437
const DEFAULT_CONSUMERS_WAIT_FOR_MESSAGES = 1;
38+
const DEFAULT_QUEUE_CONNECTION = 'db';
3539

3640
/**
3741
* The available configuration values
@@ -54,6 +58,13 @@ public function getOptions()
5458
'Should consumers wait for a message from the queue? 1 - Yes, 0 - No',
5559
self::DEFAULT_CONSUMERS_WAIT_FOR_MESSAGES
5660
),
61+
new TextConfigOption(
62+
self::INPUT_KEY_QUEUE_DEFAULT_CONNECTION,
63+
TextConfigOption::FRONTEND_WIZARD_TEXT,
64+
self::CONFIG_PATH_QUEUE_DEFAULT_CONNECTION,
65+
'Default queue connection. Can be db, amqp or a custom one.',
66+
self::DEFAULT_QUEUE_CONNECTION
67+
),
5768
];
5869
}
5970

@@ -72,6 +83,13 @@ public function createConfig(array $data, DeploymentConfig $deploymentConfig)
7283
);
7384
}
7485

86+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_DEFAULT_CONNECTION)) {
87+
$configData->set(
88+
self::CONFIG_PATH_QUEUE_DEFAULT_CONNECTION,
89+
$data[self::INPUT_KEY_QUEUE_DEFAULT_CONNECTION]
90+
);
91+
}
92+
7593
return [$configData];
7694
}
7795

dev/tests/integration/etc/post-install-setup-command-config.php.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ return [
1313
'--remote-storage-driver' => 'aws-s3',
1414
'--remote-storage-bucket' => 'myBucket',
1515
'--remote-storage-region' => 'us-east-1',
16+
'--default-connection' => 'db'
1617
]
1718
]
1819
*/

0 commit comments

Comments
 (0)