ConfigInterface.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\AsynchronousOperations\Model;
  8. use Magento\Framework\Communication\ConfigInterface as CommunicationConfig;
  9. use Magento\AsynchronousOperations\Api\Data\OperationInterface;
  10. /**
  11. * Class for accessing to Webapi_Async configuration.
  12. *
  13. * @api
  14. * @since 100.2.3
  15. */
  16. interface ConfigInterface
  17. {
  18. /**#@+
  19. * Constants for Webapi Asynchronous Config generation
  20. */
  21. const CACHE_ID = 'webapi_async_config';
  22. const TOPIC_PREFIX = 'async.';
  23. const DEFAULT_CONSUMER_INSTANCE = MassConsumer::class;
  24. const DEFAULT_CONSUMER_CONNECTION = 'amqp';
  25. const DEFAULT_CONSUMER_MAX_MESSAGE = null;
  26. const SERVICE_PARAM_KEY_INTERFACE = 'interface';
  27. const SERVICE_PARAM_KEY_METHOD = 'method';
  28. const SERVICE_PARAM_KEY_TOPIC = 'topic';
  29. const DEFAULT_HANDLER_NAME = 'async';
  30. const SYSTEM_TOPIC_NAME = 'async.system.required.wrapper.topic';
  31. const SYSTEM_TOPIC_CONFIGURATION = [
  32. CommunicationConfig::TOPIC_NAME => self::SYSTEM_TOPIC_NAME,
  33. CommunicationConfig::TOPIC_IS_SYNCHRONOUS => false,
  34. CommunicationConfig::TOPIC_REQUEST => OperationInterface::class,
  35. CommunicationConfig::TOPIC_REQUEST_TYPE => CommunicationConfig::TOPIC_REQUEST_TYPE_CLASS,
  36. CommunicationConfig::TOPIC_RESPONSE => null,
  37. CommunicationConfig::TOPIC_HANDLERS => [],
  38. ];
  39. /**#@-*/
  40. /**
  41. * Get array of generated topics name and related to this topic service class and methods
  42. *
  43. * @return array
  44. * @since 100.2.3
  45. */
  46. public function getServices();
  47. /**
  48. * Get topic name from webapi_async_config services config array by route url and http method
  49. *
  50. * @param string $routeUrl
  51. * @param string $httpMethod GET|POST|PUT|DELETE
  52. * @return string
  53. * @throws \Magento\Framework\Exception\LocalizedException
  54. * @since 100.2.3
  55. */
  56. public function getTopicName($routeUrl, $httpMethod);
  57. }