7 declare(strict_types=1);
12 use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
26 private $operationFactory;
31 private $jsonSerializer;
36 private $entityManager;
41 private $messageEncoder;
46 private $messageValidator;
56 OperationInterfaceFactory $operationFactory,
62 $this->operationFactory = $operationFactory;
63 $this->jsonSerializer = $jsonSerializer;
64 $this->messageEncoder = $messageEncoder;
65 $this->messageValidator = $messageValidator;
66 $this->entityManager = $entityManager;
75 public function createByTopic($topicName, $entityParams,
$groupId)
77 $this->messageValidator->validate($topicName, $entityParams);
78 $encodedMessage = $this->messageEncoder->encode($topicName, $entityParams);
83 'meta_information' => $encodedMessage,
95 $operation = $this->operationFactory->create(
$data);
96 return $this->entityManager->save($operation);
__construct(OperationInterfaceFactory $operationFactory, EntityManager $entityManager, MessageValidator $messageValidator, MessageEncoder $messageEncoder, Json $jsonSerializer)