Skip to content

Commit 65dad61

Browse files
committed
MCP-771: [MCP-608] Multiple consumers prototype development
- Set amqp connection for WebapiAsync;
1 parent 0821c35 commit 65dad61

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

app/code/Magento/MessageQueue/Model/Cron/ConsumersRunner.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,20 @@ public function run()
146146

147147
$this->shellBackground->execute($command, $arguments);
148148
}
149-
} else {
150-
if (!$this->lockManager->isLocked(md5($consumer->getName()))) { //phpcs:ignore
151-
$arguments = [
152-
$consumer->getName(),
153-
'--single-thread'
154-
];
155-
156-
if ($maxMessages) {
157-
$arguments[] = '--max-messages=' . min($consumer->getMaxMessages() ?? $maxMessages, $maxMessages);
158-
}
149+
} else if (!$this->lockManager->isLocked(md5($consumer->getName()))) { //phpcs:ignore
150+
$arguments = [
151+
$consumer->getName(),
152+
'--single-thread'
153+
];
154+
155+
if ($maxMessages) {
156+
$arguments[] = '--max-messages=' . min($consumer->getMaxMessages() ?? $maxMessages, $maxMessages);
157+
}
159158

160-
$command = $php . ' ' . BP . '/bin/magento queue:consumers:start %s %s'
161-
. ($maxMessages ? ' %s' : '');
159+
$command = $php . ' ' . BP . '/bin/magento queue:consumers:start %s %s'
160+
. ($maxMessages ? ' %s' : '');
162161

163-
$this->shellBackground->execute($command, $arguments);
164-
}
162+
$this->shellBackground->execute($command, $arguments);
165163
}
166164
}
167165
}

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="db"
10+
<consumer name="async.operations.all" queue="async.operations.all" connection="amqp"
1111
consumerInstance="Magento\AsynchronousOperations\Model\MassConsumer"/>
1212
</config>

0 commit comments

Comments
 (0)