Skip to content
Joshua Estes edited this page Oct 4, 2017 · 3 revisions

Broker

The Broker allows you a central place to manage multiple queues. Once you initialize a Queue, you can add this to the Broker and use this to get any of the Queues.

Usage

<?php

use Dspacelabs\Component\Queue\Broker;

// Initialize the Broker object
$broker = new Broker();

// ... initial multiple different queues ...

// Add Queues to Broker
$broker->addQueue($queueName);
$broker->addQueue($other);

// Publish a message to the "queue.name" queue
$broker->get('queue.name')->publish($message);

// Publish a message to the "other" queue
$broker->get('other')->publish($anotherMessage);

API

get($name)

addQueue(QueueInterface $queue)

Clone this wiki locally