PHP Class Bravo3\Orm\Services\PubSubManager

Afficher le fichier Open project: bravo3/orm

Protected Properties

Свойство Type Description
$driver Bravo3\Orm\Drivers\PubSubDriverInterface
$event_dispatcher Symfony\Component\EventDispatcher\EventDispatcher

Méthodes publiques

Méthode Description
__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

Private Methods

Méthode Description
generateEventName ( $channel ) : string Returns the event name with the prefix prepended.

Method Details

__construct() public méthode

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

addListener() public méthode

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
Résultat PubSubManager

eventTrigger() public méthode

Function triggers PubSub events based on the messages received on subscribed channels.
public eventTrigger ( array $payload ) : PubSubEvent
$payload array
Résultat Bravo3\Orm\Events\PubSubEvent

publish() public méthode

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
Résultat boolean

removeListener() public méthode

Removes the callbacks assigned to database driver PubSub mechanism.
public removeListener ( string $channel, callable $callback ) : PubSubManager
$channel string
$callback callable
Résultat PubSubManager

run() public méthode

public run ( ) : void
Résultat void

Property Details

$driver protected_oe property

protected PubSubDriverInterface,Bravo3\Orm\Drivers $driver
Résultat Bravo3\Orm\Drivers\PubSubDriverInterface

$event_dispatcher protected_oe property

protected EventDispatcher,Symfony\Component\EventDispatcher $event_dispatcher
Résultat Symfony\Component\EventDispatcher\EventDispatcher