1: <?php
2:
3: /**
4: * Avisota newsletter and mailing system
5: *
6: * PHP Version 5.3
7: *
8: * @copyright bit3 UG 2013
9: * @author Tristan Lins <tristan.lins@bit3.de>
10: * @package avisota-core
11: * @license LGPL-3.0+
12: * @link http://avisota.org
13: */
14:
15: namespace Avisota\Queue;
16:
17: use Avisota\Message\MessageInterface;
18: use Avisota\Transport\TransportInterface;
19: use Avisota\Transport\TransportStatus;
20:
21: /**
22: * The basic message queue interface.
23: *
24: * @package avisota-core
25: */
26: interface QueueInterface
27: {
28: /**
29: * Check if the queue is empty.
30: *
31: * @return bool
32: */
33: public function isEmpty();
34:
35: /**
36: * Return the length of the queue.
37: *
38: * @return int
39: */
40: public function length();
41:
42: /**
43: * Return all messages from the queue.
44: *
45: * @return MessageInterface[]
46: */
47: public function getMessages();
48:
49: /**
50: * Execute a queue and send all messages.
51: *
52: * @param QueueInterface $queue
53: * @param TransportInterface $transport
54: *
55: * @return TransportStatus[]
56: */
57: public function execute(TransportInterface $transport, ExecutionConfig $config = null);
58:
59: /**
60: * Enqueue a message.
61: *
62: * @param MessageInterface $message The message to enqueue.
63: * @param \DateTime $deliveryDate The message will not delivered until this
64: * date is reached.
65: *
66: * @return bool
67: */
68: public function enqueue(MessageInterface $message, \DateTime $deliveryDate = null);
69: }
70: