Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

First iteration tasks

Eugene Tulika edited this page Jan 26, 2018 · 7 revisions

Base information: https://github.com/magento-engcom/bulk-api/wiki

This document describes main concepts of new functionality on lower level

General

The main idea is creating working solution on first iteration. It helps us to:

  • possibility to immediately start implementation of base part;
  • discover new issues;
  • unblock work for more sophisticated cases.

Tasks:

Task 1: Introduce extension point in REST request processing

Status In Progress

PR magento/bulk-api-ce#1

  1. Introduce new interface RequestProcessorInterface
use Magento\Framework\Webapi\Rest\Request;
use Magento\Framework\Webapi\Rest\Response;

interface RequestProcessorInterface
{
    public function process(Request $request, Response $responce): Response;
}
  1. Inject this interface to `\Magento\Webapi\Controller\Rest
$responce = $this->requestProcessor->process($request, $responce);
  1. Base implementation of RequestProcessorInterface
private $processors;

public function process(Request $request, Response $responce)
{
   if (!isset($this->processors[$request->getPathInfo()])) {
        throw new NotFoundException(__('Specified request does not match any route.'));
   }
   $processor = $this->objectmanager->get($this->processors[$request->getPathInfo()]);
   $processor->process($request, $responce);
}
  1. Update di.xml

Something like

<item key="scheme" type="string">SchemeProcessor</item>
<item key="V1" type="string">SyncProcessor</item>

Pay attention: this task was partial finished in https://github.com/magento/bulk-api-ce/pull/1/files

Task 2: Introduce Async request processors

Status In Progress

PR [magento/bulk-api-ee#1]

  1. Request processor should set proper Status Code

202 ACCEPTED The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.

  1. Processor should set into response UID

  2. Register processor in DI

<item key="async" type="string">AsyncProcessor</item>

Task 3: Publish mechanism for Product

Status Open

Tasks #13, #14, #15

  1. Define routing between WebAPI request to the topic used by message queue publisher
  • automatically generate topics based on routes in webapi.xml as combination of route url and method. Consumers can use webapi.xml as the source of information on which Service Contract should be invoked.
  1. Describe configuration on communication.xml Generally, maybe we will expand this declaration. Know we use current declaration.

  2. Implement Magento\Catalog\Model\SaveProductPublisherInterface (interface name is preliminary)

  • Generate UID $bulkUID = $this->identityService->generateId(); // \Magento\Framework\DataObject\IdentityGeneratorInterface
  • Create factory for operations (personal factory for each entity) and encapsulate logic of operation creating
  • Schedule bulk $result = $this->bulkManagement->scheduleBulk($bulkUID, $operations, $bulkDescription, $userId); // \Magento\Framework\Bulk\BulkManagementInterface::scheduleBulk
  • Should return bulk UID
  1. Cover functionality with API functional tests (for checking result we can use some temporal new object in test namespace)

Task 4: Update Swagger Schema Generator

Status Open

Tasks #11

  1. support generation of the schema for the async routes
  2. response schema should always be the same

Task 5: Consumer for Product

  1. Map default message queue consumer to the generated topic

  2. Cover functionality with API functional tests

  3. Generate the topic to service contract on the fly based on webapi.xml.

Task 6: Introduce Web API for \Magento\Framework\Bulk\BulkStatusInterface

Task QA: Verify that Asynchronous Bulk UI works