Kraken\Channel\ChannelComposite::pull PHP Method

pull() public method

public pull ( $sender, Kraken\Channel\Protocol\ProtocolInterface $protocol )
$protocol Kraken\Channel\Protocol\ProtocolInterface
    public function pull($sender, ProtocolInterface $protocol)
    {
        $this->emit('input', [$sender, $protocol]);
    }

Usage Example

 public function createComposite($data, LoopInterface $loop)
 {
     $name = $data['name'];
     $buses = [];
     foreach ($data['buses'] as $busName => $bus) {
         $buses[$busName] = $this->createChannel($bus, $loop);
     }
     $router = new RouterComposite(['input' => $input = new Router(), 'output' => $output = new Router()]);
     $channel = new ChannelComposite($name, $buses, $router, $loop);
     $router = $channel->getInput();
     $router->addDefault(new RuleHandler(function ($params) use($channel) {
         $channel->pull($params['alias'], $params['protocol']);
     }));
     $router = $channel->getOutput();
     $router->addDefault(new RuleHandler(function ($params) use($channel) {
         $channel->push($params['alias'], $params['protocol'], $params['flags'], $params['success'], $params['failure'], $params['cancel'], $params['timeout']);
     }));
     return $channel;
 }