public function setupQueue($queueName, $channel)
    {

        foreach ($this->queueOptions as $queue => $queueOption) {
            if ($queueOption['name'] == $queueName) {
                $status = $channel->queue_declare(
                    $queueName,
                    $queueOption['passive'],
                    $queueOption['durable'],
                    $queueOption['exclusive'],
                    $queueOption['auto_delete']
                );
                return array($channel, $status);
            }
        }

        // Error as queue has not been setup
        throw new Exception($queueName . ' options not found in $this->queueOptions.');
    }
public function setupQueue($queueName, $channel)
    {

        foreach ($this->queueOptions as $queue => $queueOption) {
            if ($queueOption['name'] == $queueName) {
                $status = $channel->queue_declare(
                    $queueName,
                    $queueOption['passive'],
                    $queueOption['durable'],
                    $queueOption['exclusive'],
                    $queueOption['auto_delete']
                );
                return array($channel, $status);
            }
        }

        // Error as queue has not been setup
        throw new Exception($queueName . ' options not found in $this->queueOptions.');
    }
public function setupQueue ( $ queueName , $ channel ) { foreach ( $ this -> queueOptions as $ queue => $ queueOption ) { if ( $ queueOption [ 'name' ] == $ queueName ) { $ status = $ channel -> queue_declare ( $ queueName , $ queueOption [ 'passive' ] , $ queueOption [ 'durable' ] , $ queueOption [ 'exclusive' ] , $ queueOption [ 'auto_delete' ] ) ; return array ( $ channel , $ status ) ; } } // Error as queue has not been setup throw new Exception ( $ queueName . ' options not found in $this->queueOptions.' ) ; }
getQueue - common create queue functionality used to ensure queue settings
are the same for both producers and consumers. If the queue already exists
the details of the queue will be return.

@param string $queueName
Name of the queue

@param object $channel
The channel connection that the queue should use.

@return object $channel
The updated channel object with the new queue.

@return array $status
When a queue is already setup a queue_declare() will return details
about the existing queue.
status[1] - message count
status[2] - unacknowledged count

passive: If set, the server will reply with Declare-Ok if the queue
already exists with the same name, and raise an error if not. The client
can use this to check whether a queue exists without modifying the server
state. When set, all other method fields except name and no-wait are
ignored. A declare with both passive and no-wait has no effect.
Arguments are compared for semantic equivalence.

durable: Keep queue even if RabbitMQ is shut down. Note that messages
must also be marked as durable in order for messages in a durable queue
to survive a queue restart.

exclusive: The queue can be accessed in other channels

auto_delete: The queue won't be deleted once the channel is closed. If
set, the queue is deleted when all consumers have finished using it.
getQueue - common create queue functionality used to ensure queue settings are the same for both producers and consumers . If the queue already exists the details of the queue will be return .