/** * @param string $parent * @param string $alias * @param string $name * @param string[] $args */ public function __construct($parent, $alias, $name, $args = []) { parent::__construct(); $this->model = new RuntimeModel($parent, $alias, $name, $args); $this->model->setEventEmitter($this); }
/** * @param string $name * @param ChannelModelInterface $model * @param RouterCompositeInterface $router * @param EncoderInterface $encoder * @param LoopInterface $loop * @throws InstantiationException */ public function __construct($name, ChannelModelInterface $model, RouterCompositeInterface $router, EncoderInterface $encoder, LoopInterface $loop) { parent::__construct($loop); try { $router->getBus('input'); $router->getBus('output'); } catch (Exception $ex) { throw new InstantiationException("Could not construct Kraken\\Channel\\Channel due to Router wrong configuration."); } $this->name = $name; $this->model = $model; $this->router = $router; $this->encoder = $encoder; $this->loop = $loop; $this->handlers = []; $this->seed = GeneratorSupport::genId($this->name); $this->counter = 1000000000.0; $this->reqsHelperTimer = null; $this->repsHelperTimer = null; $this->handledRepsTimeout = 10000.0; $this->registerEvents(); $this->registerPeriodicTimers(); }