Skip to content

Commit e765c76

Browse files
Merge pull request #224 from magento-commerce/develop
MCLOUD-14104: Cloud tools October Release
2 parents 7867bd4 + 0f37b2e commit e765c76

36 files changed

+2218
-417
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/ece-tools",
33
"description": "Provides tools to build and deploy Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "2002.2.7",
5+
"version": "2002.2.8",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {

config/eol.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@ redis:
4646
eol: 2028-06-30
4747
valkey:
4848
- version: '8.0'
49-
eol: 2027-09-15
49+
eol: 2027-09-15
50+
activemq-artemis:
51+
- version: '2.42.0'
52+
eol: 2026-07-17

config/schema.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,12 @@ variables:
420420
number_of_shards: 3
421421
number_of_replicas: 3
422422
QUEUE_CONFIGURATION:
423-
description: "Replace or modify the AMQP configuration generated during the deployment process. This configuration
424-
is generated only if your project has been configured with a RabbitMQ service. To replace the existing
425-
configuration, specify values for each configuration option required for your environment.
426-
To modify the existing configuration, specify values only for the options to add or update.
427-
Then, add the `_merge: true` option."
423+
description: "Replace or modify the queue configuration generated during the deployment process. This configuration
424+
supports both AMQP (for RabbitMQ) and STOMP (for ActiveMQ Artemis) protocols. The configuration is automatically
425+
generated based on the configured service and protocol. For ActiveMQ configured with STOMP protocol, STOMP
426+
configuration will be used; otherwise, AMQP configuration is used. To replace the existing configuration,
427+
specify values for each configuration option required for your environment. To modify the existing configuration,
428+
specify values only for the options to add or update. Then, add the `_merge: true` option."
428429
type: array
429430
stages:
430431
- deploy
@@ -445,6 +446,20 @@ variables:
445446
mq:
446447
host: mq.host
447448
port: 1234
449+
user: username
450+
password: password
451+
virtualhost: /
452+
- comment: STOMP configuration example (ActiveMQ Artemis - uses hardcoded values when ActiveMQ is available)
453+
stage:
454+
deploy:
455+
QUEUE_CONFIGURATION:
456+
_merge: false
457+
stomp:
458+
host: activemq-artemis
459+
port: 61616
460+
user: admin
461+
password: admin
462+
default_connection: stomp
448463
REDIS_BACKEND:
449464
description: "Configuration the backend model for redis cache."
450465
type: string

src/Config/Amqp.php

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\MagentoCloud\Config;
99

1010
use Magento\MagentoCloud\Config\Stage\DeployInterface;
11+
use Magento\MagentoCloud\Package\UndefinedPackageException;
12+
use Magento\MagentoCloud\Service\ActiveMq;
1113
use Magento\MagentoCloud\Service\RabbitMq;
1214
use Magento\MagentoCloud\Package\MagentoVersion;
1315

@@ -16,38 +18,46 @@
1618
*/
1719
class Amqp
1820
{
21+
/**
22+
* @var ActiveMq
23+
*/
24+
private ActiveMq $activeMQ;
25+
1926
/**
2027
* @var RabbitMq
2128
*/
22-
private $rabbitMQ;
29+
private RabbitMq $rabbitMQ;
2330

2431
/**
2532
* @var DeployInterface
2633
*/
27-
private $stageConfig;
34+
private DeployInterface $stageConfig;
2835

2936
/**
3037
* @var ConfigMerger
3138
*/
32-
private $configMerger;
39+
private ConfigMerger $configMerger;
3340

3441
/**
3542
* @var MagentoVersion
3643
*/
37-
private $magentoVersion;
44+
private MagentoVersion $magentoVersion;
3845

3946
/**
40-
* @param RabbitMq $rabbitMQ
47+
* @param ActiveMq $activeMQ
48+
* @param RabbitMq $rabbitMQ
4149
* @param DeployInterface $stageConfig
42-
* @param ConfigMerger $configMerger
43-
* @param MagentoVersion $magentoVersion
50+
* @param ConfigMerger $configMerger
51+
* @param MagentoVersion $magentoVersion
4452
*/
4553
public function __construct(
54+
ActiveMq $activeMQ,
4655
RabbitMq $rabbitMQ,
4756
DeployInterface $stageConfig,
4857
ConfigMerger $configMerger,
4958
MagentoVersion $magentoVersion
5059
) {
60+
$this->activeMQ = $activeMQ;
5161
$this->rabbitMQ = $rabbitMQ;
5262
$this->stageConfig = $stageConfig;
5363
$this->configMerger = $configMerger;
@@ -58,7 +68,7 @@ public function __construct(
5868
* Returns queue configuration
5969
*
6070
* @return array
61-
* @throws \Magento\MagentoCloud\Package\UndefinedPackageException
71+
* @throws UndefinedPackageException|ConfigException
6272
*/
6373
public function getConfig(): array
6474
{
@@ -77,6 +87,7 @@ public function getConfig(): array
7787
* Returns merged queue configuration
7888
*
7989
* @return array
90+
* @throws ConfigException
8091
*/
8192
private function getMergedConfig(): array
8293
{
@@ -96,19 +107,34 @@ private function getMergedConfig(): array
96107

97108
/**
98109
* Convert amqp service configuration to magento format.
110+
* Prioritizes ActiveMQ first, then falls back to RabbitMQ.
99111
*
100112
* @return array
101113
*/
102114
private function getAmqpConfig(): array
103115
{
116+
// First priority: ActiveMQ
117+
if ($amqpConfig = $this->activeMQ->getConfiguration()) {
118+
return [
119+
'amqp' => [
120+
'host' => $amqpConfig['host'],
121+
'port' => $amqpConfig['port'],
122+
'user' => $amqpConfig['username'] ?? $amqpConfig['user'] ?? '',
123+
'password' => $amqpConfig['password'],
124+
'virtualhost' => $amqpConfig['vhost'] ?? '/',
125+
]
126+
];
127+
}
128+
129+
// Fallback: RabbitMQ
104130
if ($amqpConfig = $this->rabbitMQ->getConfiguration()) {
105131
return [
106132
'amqp' => [
107133
'host' => $amqpConfig['host'],
108134
'port' => $amqpConfig['port'],
109135
'user' => $amqpConfig['username'],
110136
'password' => $amqpConfig['password'],
111-
'virtualhost' => isset($amqpConfig['vhost']) ? $amqpConfig['vhost'] : '/',
137+
'virtualhost' => $amqpConfig['vhost'] ?? '/',
112138
]
113139
];
114140
}

src/Config/Stomp.php

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\MagentoCloud\Config;
9+
10+
use Magento\MagentoCloud\Config\Stage\DeployInterface;
11+
use Magento\MagentoCloud\Package\UndefinedPackageException;
12+
use Magento\MagentoCloud\Service\ActiveMq;
13+
use Magento\MagentoCloud\Package\MagentoVersion;
14+
15+
/**
16+
* Returns STOMP queue configuration for ActiveMQ Artemis.
17+
*/
18+
class Stomp
19+
{
20+
/**
21+
* @var ActiveMq
22+
*/
23+
private ActiveMq $activeMQ;
24+
25+
/**
26+
* @var DeployInterface
27+
*/
28+
private DeployInterface $stageConfig;
29+
30+
/**
31+
* @var ConfigMerger
32+
*/
33+
private ConfigMerger $configMerger;
34+
35+
/**
36+
* @var MagentoVersion
37+
*/
38+
private MagentoVersion $magentoVersion;
39+
40+
/**
41+
* @param ActiveMq $activeMQ
42+
* @param DeployInterface $stageConfig
43+
* @param ConfigMerger $configMerger
44+
* @param MagentoVersion $magentoVersion
45+
*/
46+
public function __construct(
47+
ActiveMq $activeMQ,
48+
DeployInterface $stageConfig,
49+
ConfigMerger $configMerger,
50+
MagentoVersion $magentoVersion
51+
) {
52+
$this->activeMQ = $activeMQ;
53+
$this->stageConfig = $stageConfig;
54+
$this->configMerger = $configMerger;
55+
$this->magentoVersion = $magentoVersion;
56+
}
57+
58+
/**
59+
* Returns STOMP queue configuration
60+
*
61+
* @return array
62+
* @throws UndefinedPackageException|ConfigException
63+
*/
64+
public function getConfig(): array
65+
{
66+
$config = $this->getMergedConfig();
67+
68+
if ($this->magentoVersion->isGreaterOrEqual('2.2')) {
69+
$config['consumers_wait_for_messages'] = $this->stageConfig->get(
70+
DeployInterface::VAR_CONSUMERS_WAIT_FOR_MAX_MESSAGES
71+
) ? 1 : 0;
72+
}
73+
74+
return $config;
75+
}
76+
77+
/**
78+
* Returns merged STOMP queue configuration
79+
*
80+
* @return array
81+
* @throws ConfigException
82+
*/
83+
private function getMergedConfig(): array
84+
{
85+
$envQueueConfig = $this->stageConfig->get(DeployInterface::VAR_QUEUE_CONFIGURATION);
86+
$stompConfig = $this->getStompConfig();
87+
88+
if ($this->configMerger->isEmpty($envQueueConfig)) {
89+
return $stompConfig;
90+
}
91+
92+
if ($this->configMerger->isMergeRequired($envQueueConfig)) {
93+
return $this->configMerger->merge($stompConfig, $envQueueConfig);
94+
}
95+
96+
return $this->configMerger->clear($envQueueConfig);
97+
}
98+
99+
/**
100+
* Convert ActiveMQ service configuration to STOMP format for Magento.
101+
* Uses dynamic connection details from ActiveMQ configuration.
102+
*
103+
* @return array
104+
*/
105+
private function getStompConfig(): array
106+
{
107+
$activeMqConfig = $this->activeMQ->getConfiguration();
108+
109+
if ($activeMqConfig) {
110+
// Use the actual host from ActiveMQ configuration
111+
$stompHost = $activeMqConfig['host'];
112+
113+
return [
114+
'stomp' => [
115+
'host' => $stompHost,
116+
'port' => '61616', // STOMP messaging port (8161 is web console)
117+
'user' => $activeMqConfig['username'] ?? $activeMqConfig['user'] ?? '',
118+
'password' => $activeMqConfig['password']
119+
],
120+
'default_connection' => 'stomp'
121+
];
122+
}
123+
124+
return [];
125+
}
126+
127+
/**
128+
* Check if ActiveMQ is available for STOMP protocol
129+
* Uses dynamic STOMP values directly from ActiveMQ configuration
130+
*
131+
* @return bool
132+
*/
133+
public function isStompEnabled(): bool
134+
{
135+
$config = $this->activeMQ->getConfiguration();
136+
return !empty($config);
137+
}
138+
}

src/Config/Validator/Deploy/ServiceVersion.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/**
2121
* Validates installed service versions according to version mapping.
22+
*
2223
* @see \Magento\MagentoCloud\Service\Validator::MAGENTO_SUPPORTED_SERVICE_VERSIONS
2324
*/
2425
class ServiceVersion implements ValidatorInterface
@@ -51,9 +52,9 @@ class ServiceVersion implements ValidatorInterface
5152
/**
5253
* @param Validator\ResultFactory $resultFactory
5354
* @param ServiceVersionValidator $serviceVersionValidator
54-
* @param ServiceFactory $serviceFactory
55-
* @param LoggerInterface $logger
56-
* @param DatabaseType $databaseType
55+
* @param ServiceFactory $serviceFactory
56+
* @param LoggerInterface $logger
57+
* @param DatabaseType $databaseType
5758
*/
5859
public function __construct(
5960
Validator\ResultFactory $resultFactory,
@@ -78,6 +79,7 @@ public function validate(): Validator\ResultInterface
7879
{
7980
try {
8081
$services = [
82+
ServiceInterface::NAME_ACTIVEMQ,
8183
ServiceInterface::NAME_RABBITMQ,
8284
ServiceInterface::NAME_REDIS,
8385
ServiceInterface::NAME_REDIS_SESSION,
@@ -96,8 +98,8 @@ public function validate(): Validator\ResultInterface
9698
$logMsq = $serviceVersion ? 'is ' . $serviceVersion : 'is not detected';
9799
$this->logger->info(sprintf('Version of service \'%s\' %s', $serviceName, $logMsq));
98100

99-
if ($serviceVersion !== '0' &&
100-
$error = $this->serviceVersionValidator->validateService($serviceName, $serviceVersion)
101+
if ($serviceVersion !== '0'
102+
&& $error = $this->serviceVersionValidator->validateService($serviceName, $serviceVersion)
101103
) {
102104
$errors[] = $error;
103105
}

0 commit comments

Comments
 (0)