| @@ 7-291 (lines=285) @@ | ||
| 4 | ||
| 5 | use Cmobi\RabbitmqBundle\Queue\QueueBagInterface; |
|
| 6 | ||
| 7 | class RpcQueueBag implements QueueBagInterface |
|
| 8 | { |
|
| 9 | private $options; |
|
| 10 | ||
| 11 | public function __construct( |
|
| 12 | $queue, |
|
| 13 | $basicQos = 1, |
|
| 14 | $passive = false, |
|
| 15 | $durable = false, |
|
| 16 | $exclusive = false, |
|
| 17 | $autoDelete = true, |
|
| 18 | $noWait = false, |
|
| 19 | array $arguments = null, |
|
| 20 | $ticket = null, |
|
| 21 | $consumerTag = '', |
|
| 22 | $noAck = false, |
|
| 23 | $noLocal = false |
|
| 24 | ) |
|
| 25 | { |
|
| 26 | $this->options = [ |
|
| 27 | 'queue' => $queue, |
|
| 28 | 'basic_qos' => $basicQos, |
|
| 29 | 'passive' => $passive, |
|
| 30 | 'durable' => $durable, |
|
| 31 | 'exclusive' => $exclusive, |
|
| 32 | 'auto_delete' => $autoDelete, |
|
| 33 | 'no_wait' => $noWait, |
|
| 34 | 'arguments' => $arguments, |
|
| 35 | 'ticket' => $ticket, |
|
| 36 | 'consumer_tag' => $consumerTag, |
|
| 37 | 'no_ack' => $noAck, |
|
| 38 | 'no_local' => $noLocal |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param $queue |
|
| 44 | */ |
|
| 45 | public function setQueue($queue) |
|
| 46 | { |
|
| 47 | $this->options['queue'] = $queue; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return string|mixed |
|
| 52 | */ |
|
| 53 | public function getQueue() |
|
| 54 | { |
|
| 55 | return $this->options['queue']; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @param $qos |
|
| 60 | */ |
|
| 61 | public function setBasicQos($qos) |
|
| 62 | { |
|
| 63 | $this->options['basic_qos'] = $qos; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @return int |
|
| 68 | */ |
|
| 69 | public function getBasicQos() |
|
| 70 | { |
|
| 71 | return $this->options['basic_qos']; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param $passive |
|
| 76 | */ |
|
| 77 | public function setPassive($passive) |
|
| 78 | { |
|
| 79 | $this->options['passive'] = $passive; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * @return bool |
|
| 84 | */ |
|
| 85 | public function getPassive() |
|
| 86 | { |
|
| 87 | return $this->options['passive']; |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * @param $durable |
|
| 92 | */ |
|
| 93 | public function setDurable($durable) |
|
| 94 | { |
|
| 95 | $this->options['durable'] = $durable; |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * @return bool |
|
| 100 | */ |
|
| 101 | public function getDurable() |
|
| 102 | { |
|
| 103 | return $this->options['durable']; |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * @param $exclusive |
|
| 108 | */ |
|
| 109 | public function setExclusive($exclusive) |
|
| 110 | { |
|
| 111 | $this->options['exclusive'] = $exclusive; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * @return bool |
|
| 116 | */ |
|
| 117 | public function getExclusive() |
|
| 118 | { |
|
| 119 | return $this->options['exclusive']; |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * @param $autoDelete |
|
| 124 | */ |
|
| 125 | public function setAutoDelete($autoDelete) |
|
| 126 | { |
|
| 127 | $this->options['auto_delete'] = $autoDelete; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * @return bool |
|
| 132 | */ |
|
| 133 | public function getAutoDelete() |
|
| 134 | { |
|
| 135 | return $this->options['auto_delete']; |
|
| 136 | } |
|
| 137 | ||
| 138 | /** |
|
| 139 | * @param $noWait |
|
| 140 | */ |
|
| 141 | public function setNoWait($noWait) |
|
| 142 | { |
|
| 143 | $this->options['no_wait'] = $noWait; |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * @return bool |
|
| 148 | */ |
|
| 149 | public function getNoWait() |
|
| 150 | { |
|
| 151 | return $this->options['no_wait']; |
|
| 152 | } |
|
| 153 | ||
| 154 | /** |
|
| 155 | * @param array $arguments |
|
| 156 | */ |
|
| 157 | public function setArguments(array $arguments) |
|
| 158 | { |
|
| 159 | $this->options['arguments'] = $arguments; |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * @return string |
|
| 164 | */ |
|
| 165 | public function getArguments() |
|
| 166 | { |
|
| 167 | return $this->options['arguments']; |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @param $ticket |
|
| 172 | */ |
|
| 173 | public function setTicket($ticket) |
|
| 174 | { |
|
| 175 | $this->options['ticket'] = $ticket; |
|
| 176 | } |
|
| 177 | ||
| 178 | /** |
|
| 179 | * @return string |
|
| 180 | */ |
|
| 181 | public function getTicket() |
|
| 182 | { |
|
| 183 | return $this->options['ticket']; |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| 187 | * @param $consumerTag |
|
| 188 | */ |
|
| 189 | public function setConsumerTag($consumerTag) |
|
| 190 | { |
|
| 191 | $this->options['consumer_tag'] = $consumerTag; |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * @return string |
|
| 196 | */ |
|
| 197 | public function getConsumerTag() |
|
| 198 | { |
|
| 199 | return $this->options['consumer_tag']; |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * @param $noAck |
|
| 204 | */ |
|
| 205 | public function setNoAck($noAck) |
|
| 206 | { |
|
| 207 | $this->options['no_ack'] = $noAck; |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| 211 | * @return bool |
|
| 212 | */ |
|
| 213 | public function getNoAck() |
|
| 214 | { |
|
| 215 | return $this->options['no_ack']; |
|
| 216 | } |
|
| 217 | ||
| 218 | /** |
|
| 219 | * @param $noLocal |
|
| 220 | */ |
|
| 221 | public function setNoLocal($noLocal) |
|
| 222 | { |
|
| 223 | $this->options['no_local'] = $noLocal; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * @return bool |
|
| 228 | */ |
|
| 229 | public function getNoLocal() |
|
| 230 | { |
|
| 231 | return $this->options['no_local']; |
|
| 232 | } |
|
| 233 | ||
| 234 | /** |
|
| 235 | * @return array |
|
| 236 | */ |
|
| 237 | public function getQueueDeclare() |
|
| 238 | { |
|
| 239 | return [ |
|
| 240 | $this->getQueue(), |
|
| 241 | $this->getPassive(), |
|
| 242 | $this->getDurable(), |
|
| 243 | $this->getExclusive(), |
|
| 244 | $this->getAutoDelete(), |
|
| 245 | $this->getNoWait(), |
|
| 246 | $this->getArguments(), |
|
| 247 | $this->getTicket() |
|
| 248 | ]; |
|
| 249 | } |
|
| 250 | ||
| 251 | /** |
|
| 252 | * @return array |
|
| 253 | */ |
|
| 254 | public function getQueueConsume() |
|
| 255 | { |
|
| 256 | return [ |
|
| 257 | $this->getQueue(), |
|
| 258 | $this->getConsumerTag(), |
|
| 259 | $this->getNoLocal(), |
|
| 260 | $this->getNoAck(), |
|
| 261 | $this->getExclusive(), |
|
| 262 | $this->getNoWait(), |
|
| 263 | $this->getTicket(), |
|
| 264 | $this->getArguments() |
|
| 265 | ]; |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * @return array|false |
|
| 270 | */ |
|
| 271 | public function getExchangeDeclare() |
|
| 272 | { |
|
| 273 | return false; |
|
| 274 | } |
|
| 275 | ||
| 276 | /** |
|
| 277 | * @return string |
|
| 278 | */ |
|
| 279 | public function getExchange() |
|
| 280 | { |
|
| 281 | return false; |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| 285 | * @return string |
|
| 286 | */ |
|
| 287 | public function getType() |
|
| 288 | { |
|
| 289 | return false; |
|
| 290 | } |
|
| 291 | } |
|
| @@ 7-291 (lines=285) @@ | ||
| 4 | ||
| 5 | use Cmobi\RabbitmqBundle\Queue\QueueBagInterface; |
|
| 6 | ||
| 7 | class WorkerQueueBag implements QueueBagInterface |
|
| 8 | { |
|
| 9 | private $options; |
|
| 10 | ||
| 11 | public function __construct( |
|
| 12 | $queue, |
|
| 13 | $basicQos = 1, |
|
| 14 | $passive = false, |
|
| 15 | $durable = true, |
|
| 16 | $exclusive = false, |
|
| 17 | $autoDelete = false, |
|
| 18 | $noWait = false, |
|
| 19 | array $arguments = null, |
|
| 20 | $ticket = null, |
|
| 21 | $consumerTag = '', |
|
| 22 | $noAck = false, |
|
| 23 | $noLocal = false |
|
| 24 | ) |
|
| 25 | { |
|
| 26 | $this->options = [ |
|
| 27 | 'queue' => $queue, |
|
| 28 | 'basic_qos' => $basicQos, |
|
| 29 | 'passive' => $passive, |
|
| 30 | 'durable' => $durable, |
|
| 31 | 'exclusive' => $exclusive, |
|
| 32 | 'auto_delete' => $autoDelete, |
|
| 33 | 'no_wait' => $noWait, |
|
| 34 | 'arguments' => $arguments, |
|
| 35 | 'ticket' => $ticket, |
|
| 36 | 'consumer_tag' => $consumerTag, |
|
| 37 | 'no_ack' => $noAck, |
|
| 38 | 'no_local' => $noLocal |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param $queue |
|
| 44 | */ |
|
| 45 | public function setQueue($queue) |
|
| 46 | { |
|
| 47 | $this->options['queue'] = $queue; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return string|mixed |
|
| 52 | */ |
|
| 53 | public function getQueue() |
|
| 54 | { |
|
| 55 | return $this->options['queue']; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @param $qos |
|
| 60 | */ |
|
| 61 | public function setBasicQos($qos) |
|
| 62 | { |
|
| 63 | $this->options['basic_qos'] = $qos; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @return int |
|
| 68 | */ |
|
| 69 | public function getBasicQos() |
|
| 70 | { |
|
| 71 | return $this->options['basic_qos']; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param $passive |
|
| 76 | */ |
|
| 77 | public function setPassive($passive) |
|
| 78 | { |
|
| 79 | $this->options['passive'] = $passive; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * @return bool |
|
| 84 | */ |
|
| 85 | public function getPassive() |
|
| 86 | { |
|
| 87 | return $this->options['passive']; |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * @param $durable |
|
| 92 | */ |
|
| 93 | public function setDurable($durable) |
|
| 94 | { |
|
| 95 | $this->options['durable'] = $durable; |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * @return bool |
|
| 100 | */ |
|
| 101 | public function getDurable() |
|
| 102 | { |
|
| 103 | return $this->options['durable']; |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * @param $exclusive |
|
| 108 | */ |
|
| 109 | public function setExclusive($exclusive) |
|
| 110 | { |
|
| 111 | $this->options['exclusive'] = $exclusive; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * @return bool |
|
| 116 | */ |
|
| 117 | public function getExclusive() |
|
| 118 | { |
|
| 119 | return $this->options['exclusive']; |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * @param $autoDelete |
|
| 124 | */ |
|
| 125 | public function setAutoDelete($autoDelete) |
|
| 126 | { |
|
| 127 | $this->options['auto_delete'] = $autoDelete; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * @return bool |
|
| 132 | */ |
|
| 133 | public function getAutoDelete() |
|
| 134 | { |
|
| 135 | return $this->options['auto_delete']; |
|
| 136 | } |
|
| 137 | ||
| 138 | /** |
|
| 139 | * @param $noWait |
|
| 140 | */ |
|
| 141 | public function setNoWait($noWait) |
|
| 142 | { |
|
| 143 | $this->options['no_wait'] = $noWait; |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * @return bool |
|
| 148 | */ |
|
| 149 | public function getNoWait() |
|
| 150 | { |
|
| 151 | return $this->options['no_wait']; |
|
| 152 | } |
|
| 153 | ||
| 154 | /** |
|
| 155 | * @param array $arguments |
|
| 156 | */ |
|
| 157 | public function setArguments(array $arguments) |
|
| 158 | { |
|
| 159 | $this->options['arguments'] = $arguments; |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * @return string |
|
| 164 | */ |
|
| 165 | public function getArguments() |
|
| 166 | { |
|
| 167 | return $this->options['arguments']; |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @param $ticket |
|
| 172 | */ |
|
| 173 | public function setTicket($ticket) |
|
| 174 | { |
|
| 175 | $this->options['ticket'] = $ticket; |
|
| 176 | } |
|
| 177 | ||
| 178 | /** |
|
| 179 | * @return string |
|
| 180 | */ |
|
| 181 | public function getTicket() |
|
| 182 | { |
|
| 183 | return $this->options['ticket']; |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| 187 | * @param $consumerTag |
|
| 188 | */ |
|
| 189 | public function setConsumerTag($consumerTag) |
|
| 190 | { |
|
| 191 | $this->options['consumer_tag'] = $consumerTag; |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * @return string |
|
| 196 | */ |
|
| 197 | public function getConsumerTag() |
|
| 198 | { |
|
| 199 | return $this->options['consumer_tag']; |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * @param $noAck |
|
| 204 | */ |
|
| 205 | public function setNoAck($noAck) |
|
| 206 | { |
|
| 207 | $this->options['no_ack'] = $noAck; |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| 211 | * @return bool |
|
| 212 | */ |
|
| 213 | public function getNoAck() |
|
| 214 | { |
|
| 215 | return $this->options['no_ack']; |
|
| 216 | } |
|
| 217 | ||
| 218 | /** |
|
| 219 | * @param $noLocal |
|
| 220 | */ |
|
| 221 | public function setNoLocal($noLocal) |
|
| 222 | { |
|
| 223 | $this->options['no_local'] = $noLocal; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * @return bool |
|
| 228 | */ |
|
| 229 | public function getNoLocal() |
|
| 230 | { |
|
| 231 | return $this->options['no_local']; |
|
| 232 | } |
|
| 233 | ||
| 234 | /** |
|
| 235 | * @return array |
|
| 236 | */ |
|
| 237 | public function getQueueDeclare() |
|
| 238 | { |
|
| 239 | return [ |
|
| 240 | $this->getQueue(), |
|
| 241 | $this->getPassive(), |
|
| 242 | $this->getDurable(), |
|
| 243 | $this->getExclusive(), |
|
| 244 | $this->getAutoDelete(), |
|
| 245 | $this->getNoWait(), |
|
| 246 | $this->getArguments(), |
|
| 247 | $this->getTicket() |
|
| 248 | ]; |
|
| 249 | } |
|
| 250 | ||
| 251 | /** |
|
| 252 | * @return array |
|
| 253 | */ |
|
| 254 | public function getQueueConsume() |
|
| 255 | { |
|
| 256 | return [ |
|
| 257 | $this->getQueue(), |
|
| 258 | $this->getConsumerTag(), |
|
| 259 | $this->getNoLocal(), |
|
| 260 | $this->getNoAck(), |
|
| 261 | $this->getExclusive(), |
|
| 262 | $this->getNoWait(), |
|
| 263 | $this->getTicket(), |
|
| 264 | $this->getArguments() |
|
| 265 | ]; |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * @return array|false |
|
| 270 | */ |
|
| 271 | public function getExchangeDeclare() |
|
| 272 | { |
|
| 273 | return false; |
|
| 274 | } |
|
| 275 | ||
| 276 | /** |
|
| 277 | * @return string |
|
| 278 | */ |
|
| 279 | public function getExchange() |
|
| 280 | { |
|
| 281 | return false; |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| 285 | * @return string |
|
| 286 | */ |
|
| 287 | public function getType() |
|
| 288 | { |
|
| 289 | return false; |
|
| 290 | } |
|
| 291 | } |
|