ConsumerConfigurationInterface.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\MessageQueue;
  7. /**
  8. * Configuration for the consumer.
  9. */
  10. interface ConsumerConfigurationInterface
  11. {
  12. const CONSUMER_NAME = "consumer_name";
  13. const QUEUE_NAME = "queue_name";
  14. const MAX_MESSAGES = "max_messages";
  15. const SCHEMA_TYPE = "schema_type";
  16. const TOPICS = 'topics';
  17. const TOPIC_TYPE = 'consumer_type';
  18. const TOPIC_HANDLERS = 'handlers';
  19. const TYPE_SYNC = 'sync';
  20. const TYPE_ASYNC = 'async';
  21. const INSTANCE_TYPE_BATCH = 'batch';
  22. const INSTANCE_TYPE_SINGULAR = 'singular';
  23. /**
  24. * Get consumer name.
  25. *
  26. * @return string
  27. */
  28. public function getConsumerName();
  29. /**
  30. * Get the name of queue which consumer will read from.
  31. *
  32. * @return string
  33. */
  34. public function getQueueName();
  35. /**
  36. * Get consumer type sync|async.
  37. *
  38. * @return string
  39. * @deprecated 102.0.1
  40. * @see \Magento\Framework\Communication\ConfigInterface::getTopic
  41. * @throws \LogicException
  42. */
  43. public function getType();
  44. /**
  45. * Get maximum number of message, which will be read by consumer before termination of the process.
  46. *
  47. * @return int|null
  48. */
  49. public function getMaxMessages();
  50. /**
  51. * Get handlers by topic type.
  52. *
  53. * @param string $topicName
  54. * @return callback[]
  55. * @throws \LogicException
  56. */
  57. public function getHandlers($topicName);
  58. /**
  59. * Get topics.
  60. *
  61. * @return string[]
  62. */
  63. public function getTopicNames();
  64. /**
  65. * @param string $topicName
  66. * @return string
  67. */
  68. public function getMessageSchemaType($topicName);
  69. /**
  70. * @return QueueInterface
  71. */
  72. public function getQueue();
  73. }