Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
messages_done_old.php
Go to the documentation of this file.
1 <?php
8 
10 $messageFactory = $objectManager->create(\Magento\MysqlMq\Model\MessageFactory::class);
12  ->load('topic.updated.use.just.in.tests', 'topic_name');
13 
15 
17 $queueFactory = $objectManager->create(\Magento\MysqlMq\Model\QueueFactory::class);
19  ->load('queue1', Magento\MysqlMq\Model\Queue::KEY_NAME)
20  ->getId();
22  ->load('queue2', Magento\MysqlMq\Model\Queue::KEY_NAME)
23  ->getId();
25  ->load('queue3', Magento\MysqlMq\Model\Queue::KEY_NAME)
26  ->getId();
28  ->load('queue4', Magento\MysqlMq\Model\Queue::KEY_NAME)
29  ->getId();
30 
31 $plan = [
32  [
34  $queueId1,
36  ],
37  [
39  $queueId2,
41  ],
42  [
44  $queueId3,
46  ],
47 ];
48 
50 $messageStatusFactory = $objectManager->create(\Magento\MysqlMq\Model\MessageStatusFactory::class);
51 foreach ($plan as $instruction) {
52  $messageStatus = $messageStatusFactory->create();
53 
54  $messageStatus->setQueueId($instruction[1])
55  ->setMessageId($instruction[0])
56  ->setUpdatedAt($instruction[2])
57  ->setStatus($instruction[3])
58  ->save();
59 }
$messageFactory
$queueFactory
$messageStatusFactory
$objectManager