QueueInterface.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * Interface for interaction with message queue.
  9. *
  10. * @api
  11. * @since 102.0.1
  12. * @since 100.0.2
  13. */
  14. interface QueueInterface
  15. {
  16. /**
  17. * Get message from queue
  18. *
  19. * @return EnvelopeInterface
  20. * @since 102.0.1
  21. */
  22. public function dequeue();
  23. /**
  24. * Acknowledge message delivery
  25. *
  26. * @param EnvelopeInterface $envelope
  27. * @return void
  28. * @since 102.0.1
  29. */
  30. public function acknowledge(EnvelopeInterface $envelope);
  31. /**
  32. * Wait for messages and dispatch them
  33. *
  34. * @param callable|array $callback
  35. * @return void
  36. * @since 102.0.1
  37. */
  38. public function subscribe($callback);
  39. /**
  40. * Reject message
  41. *
  42. * @param EnvelopeInterface $envelope
  43. * @param bool $requeue
  44. * @param string $rejectionMessage
  45. * @return void
  46. * @since 102.0.1
  47. */
  48. public function reject(EnvelopeInterface $envelope, $requeue = true, $rejectionMessage = null);
  49. /**
  50. * Push message to queue directly, without using exchange
  51. *
  52. * @param EnvelopeInterface $envelope
  53. * @return void
  54. * @since 102.0.1
  55. */
  56. public function push(EnvelopeInterface $envelope);
  57. }