1 | <?php |
||
14 | class Driver implements DriverInterface, ContainerAwareInterface |
||
15 | { |
||
16 | use ContainerAwareTrait; |
||
17 | |||
18 | protected $debug; |
||
19 | protected $connections; |
||
20 | |||
21 | /** |
||
22 | * @param string $queueName |
||
23 | * @return \Kaliop\QueueingBundle\Queue\ProducerInterface |
||
24 | */ |
||
25 | public function getProducer($queueName) |
||
29 | |||
30 | /** |
||
31 | * This method is more flexible than what is declared in the interface, as it allows direct injection of a callback |
||
32 | * by the caller instead of relying solely on service configuration. |
||
33 | * It helps when queues are created dynamically. |
||
34 | * |
||
35 | * @param string $queueName |
||
36 | * @param MessageConsumerInterface|null $callback when null, the appropriate MessageConsumer for the queue is looked |
||
37 | * up in service configuration |
||
38 | * @return object |
||
39 | */ |
||
40 | public function getConsumer($queueName, MessageConsumerInterface $callback = null) |
||
44 | |||
45 | public function acceptMessage($message) |
||
49 | |||
50 | /** |
||
51 | * Unlike the RabbitMQ driver, we do not have to deal with a native message type from the underlying library. |
||
52 | * So we just let the Producer create messages of the good type, and decoding them becomes a no-op |
||
53 | * |
||
54 | * @param \Kaliop\Queueing\Plugins\SQSBundle\Adapter\SQS\Message $message |
||
55 | * @return \Kaliop\Queueing\Plugins\SQSBundle\Adapter\SQS\Message |
||
56 | */ |
||
57 | public function decodeMessage($message) |
||
61 | |||
62 | /** |
||
63 | * @param string $queueName |
||
64 | * @return \Kaliop\QueueingBundle\Queue\QueueManagerInterface |
||
65 | */ |
||
66 | public function getQueueManager($queueName) |
||
72 | |||
73 | public function setDebug($debug) |
||
79 | |||
80 | /** |
||
81 | * @param string $connectionId |
||
82 | * @param array $params |
||
83 | */ |
||
84 | public function registerConnection($connectionId, array $params) |
||
88 | |||
89 | protected function getConnectionConfig($connectionId) |
||
97 | |||
98 | /** |
||
99 | * Dynamically creates a producer, with no need for configuration except for the connection configuration |
||
100 | * |
||
101 | * @param string $queueName |
||
102 | * @param string $queueUrl |
||
103 | * @param string $connectionId |
||
104 | * @return mixed |
||
105 | */ |
||
106 | public function createProducer($queueName, $queueUrl, $connectionId) |
||
114 | |||
115 | /** |
||
116 | * Dynamically creates a consumer, with no need for configuration except for the connection configuration |
||
117 | * |
||
118 | * @param string $queueName |
||
119 | * @param string $queueUrl |
||
120 | * @param string $connectionId Id of a connection as defined in configuration |
||
121 | * @param MessageConsumerInterface $callback |
||
122 | * @param string $routingKey |
||
123 | * @return Consumer |
||
124 | */ |
||
125 | public function createConsumer($queueName, $queueUrl, $connectionId, $callback=null, $routingKey=null) |
||
136 | } |
||
137 |