PHP Class Kraken\Channel\ChannelComposite

Inheritance: extends Kraken\Event\BaseEventEmitter, implements Kraken\Channel\ChannelCompositeInterface, use trait Kraken\Loop\LoopAwareTrait
Show file Open project: kraken-php/framework Class Usage Examples

Protected Properties

Property Type Description
$buses Kraken\Channel\ChannelInterface[] | Kraken\Channel\ChannelCompositeInterface[]
$counter integer
$events Kraken\Event\EventListener[][]
$name string
$router Kraken\Channel\Router\RouterCompositeInterface
$seed string

Public Methods

Method Description
__construct ( string $name, Kraken\Channel\ChannelInterface[] | Kraken\Channel\ChannelCompositeInterface[] $buses = [], Kraken\Channel\Router\RouterCompositeInterface $router, Kraken\Loop\LoopInterface $loop )
__destruct ( )
createProtocol ( $message = null )
existsBus ( $name )
filterConnected ( $pattern )
getBus ( $name )
getBuses ( )
getConnected ( )
getInput ( )
getModel ( )
getName ( )
getOutput ( )
getRouter ( )
handleReceive ( string $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
isConnected ( $name )
isStarted ( )
isStopped ( )
onConnect ( callable $handler )
onDisconnect ( callable $handler )
onInput ( callable $handler )
onOutput ( callable $handler )
onStart ( callable $handler )
onStop ( callable $handler )
pull ( $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
push ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
pushAsync ( $name, $message, $flags = Channel::MODE_DEFAULT )
pushRequest ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
receive ( $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
removeBus ( $name )
send ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
sendAsync ( $name, $message, $flags = Channel::MODE_DEFAULT )
sendRequest ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
setBus ( $name, $channel )
start ( )
stop ( )

Protected Methods

Method Description
createMessageProtocol ( Kraken\Channel\Protocol\ProtocolInterface | null | string | string[] $message ) : Kraken\Channel\Protocol\ProtocolInterface
genID ( ) : string
getNextSuffix ( ) : integer
getTime ( ) : float
handlePushAsync ( string $name, Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT ) : boolean
handlePushRequest ( string $name, string | Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, float $timeout ) : boolean
handleSendAsync ( string $name, Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT ) : boolean
handleSendRequest ( string $name, string | Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, float $timeout ) : bool[]

Private Methods

Method Description
combine ( mixed | mixed[] | null $in, mixed | mixed[] | null $out, callable $combinator ) : mixed | mixed[]

Method Details

__construct() public method

public __construct ( string $name, Kraken\Channel\ChannelInterface[] | Kraken\Channel\ChannelCompositeInterface[] $buses = [], Kraken\Channel\Router\RouterCompositeInterface $router, Kraken\Loop\LoopInterface $loop )
$name string
$buses Kraken\Channel\ChannelInterface[] | Kraken\Channel\ChannelCompositeInterface[]
$router Kraken\Channel\Router\RouterCompositeInterface
$loop Kraken\Loop\LoopInterface

__destruct() public method

public __destruct ( )

createMessageProtocol() protected method

protected createMessageProtocol ( Kraken\Channel\Protocol\ProtocolInterface | null | string | string[] $message ) : Kraken\Channel\Protocol\ProtocolInterface
$message Kraken\Channel\Protocol\ProtocolInterface | null | string | string[]
return Kraken\Channel\Protocol\ProtocolInterface

createProtocol() public method

public createProtocol ( $message = null )

existsBus() public method

public existsBus ( $name )

filterConnected() public method

public filterConnected ( $pattern )

genID() protected method

protected genID ( ) : string
return string

getBus() public method

public getBus ( $name )

getBuses() public method

public getBuses ( )

getConnected() public method

public getConnected ( )

getInput() public method

public getInput ( )

getModel() public method

public getModel ( )

getName() public method

public getName ( )

getNextSuffix() protected method

protected getNextSuffix ( ) : integer
return integer

getOutput() public method

public getOutput ( )

getRouter() public method

public getRouter ( )

getTime() protected method

protected getTime ( ) : float
return float

handlePushAsync() protected method

protected handlePushAsync ( string $name, Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT ) : boolean
$name string
$message Kraken\Channel\Protocol\ProtocolInterface
$flags integer
return boolean

handlePushRequest() protected method

protected handlePushRequest ( string $name, string | Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, float $timeout ) : boolean
$name string
$message string | Kraken\Channel\Protocol\ProtocolInterface
$flags integer
$success callable
$failure callable
$cancel callable
$timeout float
return boolean

handleReceive() public method

public handleReceive ( string $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
$sender string
$protocol Kraken\Channel\Protocol\ProtocolInterface

handleSendAsync() protected method

protected handleSendAsync ( string $name, Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT ) : boolean
$name string
$message Kraken\Channel\Protocol\ProtocolInterface
$flags integer
return boolean

handleSendRequest() protected method

protected handleSendRequest ( string $name, string | Kraken\Channel\Protocol\ProtocolInterface $message, integer $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, float $timeout ) : bool[]
$name string
$message string | Kraken\Channel\Protocol\ProtocolInterface
$flags integer
$success callable
$failure callable
$cancel callable
$timeout float
return bool[]

isConnected() public method

public isConnected ( $name )

isStarted() public method

public isStarted ( )

isStopped() public method

public isStopped ( )

onConnect() public method

public onConnect ( callable $handler )
$handler callable

onDisconnect() public method

public onDisconnect ( callable $handler )
$handler callable

onInput() public method

public onInput ( callable $handler )
$handler callable

onOutput() public method

public onOutput ( callable $handler )
$handler callable

onStart() public method

public onStart ( callable $handler )
$handler callable

onStop() public method

public onStop ( callable $handler )
$handler callable

pull() public method

public pull ( $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
$protocol Kraken\Channel\Protocol\ProtocolInterface

push() public method

public push ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
$success callable
$failure callable
$cancel callable

pushAsync() public method

public pushAsync ( $name, $message, $flags = Channel::MODE_DEFAULT )

pushRequest() public method

public pushRequest ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
$success callable
$failure callable
$cancel callable

receive() public method

public receive ( $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
$protocol Kraken\Channel\Protocol\ProtocolInterface

removeBus() public method

public removeBus ( $name )

send() public method

public send ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
$success callable
$failure callable
$cancel callable

sendAsync() public method

public sendAsync ( $name, $message, $flags = Channel::MODE_DEFAULT )

sendRequest() public method

public sendRequest ( $name, $message, $flags = Channel::MODE_DEFAULT, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
$success callable
$failure callable
$cancel callable

setBus() public method

public setBus ( $name, $channel )

start() public method

public start ( )

stop() public method

public stop ( )

Property Details

$buses protected property

protected ChannelInterface[],Kraken\Channel|ChannelCompositeInterface[],Kraken\Channel $buses
return Kraken\Channel\ChannelInterface[] | Kraken\Channel\ChannelCompositeInterface[]

$counter protected property

protected int $counter
return integer

$events protected property

protected EventListener[][],Kraken\Event $events
return Kraken\Event\EventListener[][]

$name protected property

protected string $name
return string

$router protected property

protected RouterCompositeInterface,Kraken\Channel\Router $router
return Kraken\Channel\Router\RouterCompositeInterface

$seed protected property

protected string $seed
return string