Magento2 - Bulk Operations Consumer Issue

945 Views Asked by At

I am trying to create a publisher and a consumer to handle a big import. I have succesfully managed to set up the publisher in order to push messages to the queue, the problem is that the consumer is not called in order to read the messages and execute the scheduled operations.

The only documentation I have found is only : https://devdocs.magento.com/guides/v2.2/extension-dev-guide/message-queues/implement-bulk.html

I followed the guide , but it doesn't seem to work properly. All the bulks are scheduled correctly but they don't start. Is there a cron that takes care of this or the consumer should just be called after the bulk is created?

Thank you!

1

There are 1 best solutions below

0
Andrei Suciu On

The main problem was that the bulk operations were not creating in order for the bulk schedule to start. If you follow this link https://devdocs.magento.com/guides/v2.2/extension-dev-guide/message-queues/implement-bulk.html and change the consumer method you will be able to create the operations.

In order to create the bulk operations I replaced the changeOperationStatus function with inserting the entry directly using the bulk id , topic name and status. The problem with this function was that the first operation was not created and the update status did not work.

$this->operationManagement->changeOperationStatus(
            $operation->getId(),
            $status,
            $errorCode,
            $message,
            $serializedData
        );