PHP Класс Bravo3\Orm\Services\PubSubManager

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$driver Bravo3\Orm\Drivers\PubSubDriverInterface
$event_dispatcher Symfony\Component\EventDispatcher\EventDispatcher

Открытые методы

Метод Описание
__construct ( Bravo3\Orm\Drivers\PubSubDriverInterface $driver )
addListener ( string $channel, callable $callback, integer $priority ) : PubSubManager Add a callback to a channel which will get triggered when channel receives a message via a publisher.
eventTrigger ( array $payload ) : PubSubEvent Function triggers PubSub events based on the messages received on subscribed channels.
publish ( string $channel, string $message ) : boolean Publishes a message to the configured channel. Channel and Message length is limited based on the driver used.
removeListener ( string $channel, callable $callback ) : PubSubManager Removes the callbacks assigned to database driver PubSub mechanism.
run ( ) : void

Приватные методы

Метод Описание
generateEventName ( $channel ) : string Returns the event name with the prefix prepended.

Описание методов

__construct() публичный Метод

public __construct ( Bravo3\Orm\Drivers\PubSubDriverInterface $driver )
$driver Bravo3\Orm\Drivers\PubSubDriverInterface

addListener() публичный Метод

Add a callback to a channel which will get triggered when channel receives a message via a publisher.
public addListener ( string $channel, callable $callback, integer $priority ) : PubSubManager
$channel string
$callback callable
$priority integer Default: 0
Результат PubSubManager

eventTrigger() публичный Метод

Function triggers PubSub events based on the messages received on subscribed channels.
public eventTrigger ( array $payload ) : PubSubEvent
$payload array
Результат Bravo3\Orm\Events\PubSubEvent

publish() публичный Метод

Returns true on success of delivery of the message, or false on failure. Usually a message delivery fails if there are not subscribed clients for the channel.
public publish ( string $channel, string $message ) : boolean
$channel string
$message string
Результат boolean

removeListener() публичный Метод

Removes the callbacks assigned to database driver PubSub mechanism.
public removeListener ( string $channel, callable $callback ) : PubSubManager
$channel string
$callback callable
Результат PubSubManager

run() публичный Метод

public run ( ) : void
Результат void

Описание свойств

$driver защищенное свойство

protected PubSubDriverInterface,Bravo3\Orm\Drivers $driver
Результат Bravo3\Orm\Drivers\PubSubDriverInterface

$event_dispatcher защищенное свойство

protected EventDispatcher,Symfony\Component\EventDispatcher $event_dispatcher
Результат Symfony\Component\EventDispatcher\EventDispatcher