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

Asynchronous Web API and Async Swagger by Comwrap and Balance Internet #8

Merged
merged 92 commits into from
Mar 30, 2018

Conversation

vrann
Copy link
Contributor

@vrann vrann commented Mar 21, 2018

Description

As a Magento Developer, I would like to make WebAPI calls asynchronously so that my integrations don't have to wait for my requests to get processed to complete when it's not necessary.

In the product update context, this means that I can invoke single or bulk product APIs and get an immediate response that my request was accepted, and I'm offered a separate status reporting API to check on the progress of my requests by ID. For now this will only be available in Commerce and not Open Source.

Scope

Stories

  1. Support for Async operations in WebAPI magento-engcom/bulk-api#4: Support for Async operations in WebAPI

Combines followinf PRs

#9
#7
#6

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Vasiliev.A and others added 18 commits March 20, 2018 12:25
- get AsynchronousRequestProcessor implement ProcessorInterface
- remove exception hiding
- moved preference to be loaded earlier in the process
- add proxies for the queue commands
- Asynchronous schema processor class must implement interface
- updated class namespace
- updated config.json with the correct values
- removed unused variables and methods
*/
public function canProcess(\Magento\Framework\Webapi\Rest\Request $request)
{
if (preg_match(self::PROCESSOR_PATH, ltrim($request->getPathInfo(), '/')) === 0) {
Copy link
Member

@careys7 careys7 Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following:

GET https://bulk-api.localhost/rest/all/schema?services=all
<response>
<message>
Warning: preg_match(): Delimiter must not be alphanumeric or backslash in /var/www/current/src/app/code/Magento/WebapiAsync/Controller/Rest/AsynchronousSchemaRequestProcessor.php on line 69
</message>
<trace>
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'preg_match(): D...', '/var/www/curren...', 69, Array) #1 /var/www/current/src/app/code/Magento/WebapiAsync/Controller/Rest/AsynchronousSchemaRequestProcessor.php(69): preg_match('async/schema', 'schema') #2 /var/www/current/src/app/code/Magento/Webapi/Controller/Rest/RequestProcessorPool.php(39): Magento\WebapiAsync\Controller\Rest\AsynchronousSchemaRequestProcessor->canProcess(Object(Magento\Framework\Webapi\Rest\Request\Proxy)) #3 /var/www/current/src/app/code/Magento/Webapi/Controller/Rest.php(187): Magento\Webapi\Controller\Rest\RequestProcessorPool->getProcessor(Object(Magento\Framework\Webapi\Rest\Request\Proxy)) #4 /var/www/current/src/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http)) #5 /var/www/current/src/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array) #6 /var/www/current/src/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #7 /var/www/current/src/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array) #8 /var/www/current/src/lib/internal/Magento/Framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #9 /var/www/current/src/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch() #10 /var/www/current/src/lib/internal/Magento/Framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch() #11 /var/www/current/src/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #12 {main}
</trace>
</response>

Looking at this now. It's wrapped in an XML response so I think something else might have gone wrong before this

* See COPYING.txt for license details.
*/

namespace Magento\Webapi\Test\Unit\Controller;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be WebapiAsync

vrann and others added 9 commits March 22, 2018 12:45
- changed exception handling in MassSchedule
- added base test case class to test Async WebAPI
- Extracted default rest implementation to SwaggerWebapi module
- Renamed Magento\Swagger\Block\Index::getParamSchemaType() to Magento\Swagger\Block\Index::getSchemaType()
- Changed injection of SchemaTypes to a native PHP array, removed SchemaTypesInterface argument to swagger block
- Changed composer version
- Fixed composer namespace in SwaggerWebapi
- Added requires to composer for both modules (they will require this in the future due to a constant required from Webapi & WebapiAsync)
- Changed setup_version to 2.0.0
…Async

Added WebapiAsync configuration locator, converter and reader

Draft implementation of ServiceMetadata plugin for WebapiAsync

Changes to SwaggerwebapiAsync and WebapiAsync modules

Refactored WebapiAsync Config to ServiceConfig

- Extracted methods from ServiceConfig::convert() for readability
- Renamed Config to ServiceConfig to avoid conflicts with topic-related config
vrann added 23 commits March 28, 2018 10:41
- Disable topic generation for performance tests
- removed unused variable
- enabled topic generation for performance tests
- disabled extension for performance tests
- changed interface names per architectural feedback
- added statuses tracking for successfull operations
@magento-engcom-team magento-engcom-team merged commit 9dfc236 into 2.3-develop Mar 30, 2018
@vrann vrann changed the title Create Async Web API processor by @comwrap Asynchronous Web API and Async Swagger by Comwrap and Balance Internet Mar 30, 2018
magento-engcom-team pushed a commit that referenced this pull request Jul 21, 2018
magento-engcom-team pushed a commit that referenced this pull request Jul 23, 2018
magento-engcom-team pushed a commit that referenced this pull request Nov 16, 2018
magento-engcom-team pushed a commit that referenced this pull request Feb 25, 2019
[Forwardport] 'Fixes-for-customer-login-page-input-field' :: On customer login page…
magento-engcom-team pushed a commit that referenced this pull request Mar 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants