| @@ 88-102 (lines=15) @@ | ||
| 85 | * @param int $flags |
|
| 86 | * @param array $arguments |
|
| 87 | */ |
|
| 88 | public function declareExchange($exchangeName, $exchangeType, $flags = null, $arguments = []) |
|
| 89 | { |
|
| 90 | $this->ensureChannel(); |
|
| 91 | if (!isset($this->declaredExchangeInstances[$exchangeName])) { |
|
| 92 | $exchange = new AMQPExchange($this->channel); |
|
| 93 | $this->declaredExchangeInstances[$exchangeName] = $exchange; |
|
| 94 | if ($flags !== null) { |
|
| 95 | $exchange->setFlags($flags); |
|
| 96 | } |
|
| 97 | $exchange->setName($exchangeName); |
|
| 98 | $exchange->setType($exchangeType); |
|
| 99 | $exchange->setArguments($arguments); |
|
| 100 | $exchange->declareExchange(); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * @param string $queueName |
|
| @@ 109-123 (lines=15) @@ | ||
| 106 | * @param int $flags |
|
| 107 | * @param array $arguments |
|
| 108 | */ |
|
| 109 | public function declareQueue($queueName, $flags = null, $arguments = []) |
|
| 110 | { |
|
| 111 | $this->ensureChannel(); |
|
| 112 | ||
| 113 | if (!isset($this->declaredQueueInstances[$queueName])) { |
|
| 114 | $queue = new AMQPQueue($this->channel); |
|
| 115 | $this->declaredQueueInstances[$queueName] = $queue; |
|
| 116 | if ($flags !== null) { |
|
| 117 | $queue->setFlags($flags); |
|
| 118 | } |
|
| 119 | $queue->setName($queueName); |
|
| 120 | $queue->setArguments($arguments); |
|
| 121 | $queue->declareQueue(); |
|
| 122 | } |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * WARNING: amqp 1.4.0 on x64 is bugged and will randomly hang when attempting to bind exchanges |
|