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