PHP Class Kraken\Channel\Channel

Inheritance: extends Kraken\Event\EventEmitter, implements Kraken\Channel\ChannelInterface, use trait Kraken\Loop\LoopAwareTrait, use trait Kraken\Channel\Record\RequestRecordStorage, use trait Kraken\Channel\Record\ResponseRecordStorage
ファイルを表示 Open project: kraken-php/framework Class Usage Examples

Protected Properties

Property Type Description
$counter integer
$encoder Kraken\Channel\Encoder\EncoderInterface
$handlers Kraken\Event\EventListener[]
$model Kraken\Channel\ChannelModelInterface
$name string
$repsHelperTimer Kraken\Loop\Timer\TimerInterface
$reqsHelperTimer Kraken\Loop\Timer\TimerInterface
$router Kraken\Channel\Router\RouterCompositeInterface
$seed string

Public Methods

Method Description
__construct ( string $name, Kraken\Channel\ChannelModelInterface $model, Kraken\Channel\Router\RouterCompositeInterface $router, Kraken\Channel\Encoder\EncoderInterface $encoder, Kraken\Loop\LoopInterface $loop )
__destruct ( )
createProtocol ( $message = null )
filterConnected ( $pattern )
getConnected ( )
getInput ( )
getModel ( )
getName ( )
getOutput ( )
getRouter ( )
handleReceive ( $sender, $multipartMessage )
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 )
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 )
start ( )
stop ( )

Protected Methods

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

Private Methods

Method Description
registerEvents ( )
registerPeriodicTimers ( )
unregisterEvents ( )
unregisterPeriodicTimers ( )

Method Details

__construct() public method

public __construct ( string $name, Kraken\Channel\ChannelModelInterface $model, Kraken\Channel\Router\RouterCompositeInterface $router, Kraken\Channel\Encoder\EncoderInterface $encoder, Kraken\Loop\LoopInterface $loop )
$name string
$model Kraken\Channel\ChannelModelInterface
$router Kraken\Channel\Router\RouterCompositeInterface
$encoder Kraken\Channel\Encoder\EncoderInterface
$loop Kraken\Loop\LoopInterface

__destruct() public method

public __destruct ( )

createMessageProtocol() protected method

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

createProtocol() public method

public createProtocol ( $message = null )

filterConnected() public method

public filterConnected ( $pattern )

genID() protected method

protected genID ( ) : string
return string

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 ( ) : string
return string

getOutput() public method

public getOutput ( )

getRouter() public method

public getRouter ( )

getTime() protected method

protected getTime ( ) : float
return float

handlePushAsync() protected method

protected handlePushAsync ( $name, $message, $flags = Channel::MODE_DEFAULT )

handlePushRequest() protected method

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

handleReceive() public method

public handleReceive ( $sender, $multipartMessage )

handleReceiveRequest() protected method

protected handleReceiveRequest ( Kraken\Channel\Protocol\ProtocolInterface $protocol ) : boolean
$protocol Kraken\Channel\Protocol\ProtocolInterface
return boolean

handleReceiveResponse() protected method

protected handleReceiveResponse ( Kraken\Channel\Protocol\ProtocolInterface $protocol ) : boolean
$protocol Kraken\Channel\Protocol\ProtocolInterface
return boolean

handleSendAsync() protected method

protected handleSendAsync ( $name, $message, $flags = Channel::MODE_DEFAULT )

handleSendRequest() protected method

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

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

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

start() public method

public start ( )

stop() public method

public stop ( )

Property Details

$counter protected_oe property

protected int $counter
return integer

$encoder protected_oe property

protected EncoderInterface,Kraken\Channel\Encoder $encoder
return Kraken\Channel\Encoder\EncoderInterface

$handlers protected_oe property

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

$model protected_oe property

protected ChannelModelInterface,Kraken\Channel $model
return Kraken\Channel\ChannelModelInterface

$name protected_oe property

protected string $name
return string

$repsHelperTimer protected_oe property

protected TimerInterface,Kraken\Loop\Timer $repsHelperTimer
return Kraken\Loop\Timer\TimerInterface

$reqsHelperTimer protected_oe property

protected TimerInterface,Kraken\Loop\Timer $reqsHelperTimer
return Kraken\Loop\Timer\TimerInterface

$router protected_oe property

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

$seed protected_oe property

protected string $seed
return string