-
Notifications
You must be signed in to change notification settings - Fork 3
First iteration tasks
Base information: https://github.com/magento-engcom/bulk-api/wiki
This document describes main concepts of new functionality on lower level
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.
Status In Progress
- 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;
}
- Inject this interface to `\Magento\Webapi\Controller\Rest
$responce = $this->requestProcessor->process($request, $responce);
- 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);
}
- 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
Status In Progress
- 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.
-
Processor should set into response UID
-
Register processor in DI
<item key="async" type="string">AsyncProcessor</item>
Status Open
- 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.
-
Describe configuration on
communication.xml
Generally, maybe we will expand this declaration. Know we use current declaration. -
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
- Cover functionality with API functional tests (for checking result we can use some temporal new object in test namespace)
Status Open
Tasks #11
- support generation of the schema for the async routes
- response schema should always be the same
-
Map default message queue consumer to the generated topic
-
Cover functionality with API functional tests
-
Generate the topic to service contract on the fly based on webapi.xml.