Пример #1
0
 /**
  *
  * @param \Thruway\ClientSession $session
  * @param \Thruway\Transport\TransportInterface $transport
  */
 public function onSessionStart($session, $transport)
 {
     $session->register('add_command', [$this, 'addCommand']);
     $session->register('status', [$this, 'status']);
     $session->register('start_process', [$this, 'startProcess']);
     $session->register('stop_process', [$this, 'stopProcess']);
     $session->register('restart_process', [$this, 'restartProcess']);
     $session->register('add_instance', [$this, 'addInstance']);
     //Congestion Manager Client.  This needs to be a separate client because it needs to listen on the main realm and not `process_manager`.
     $config = $this->container->getParameter('voryx_thruway');
     $congestionManager = new Client($config['realm'], $session->getLoop());
     $congestionManager->addTransportProvider(new PawlTransportProvider($config['trusted_url']));
     $congestionManager->on('open', function (ClientSession $session) {
         $session->subscribe("thruway.metaevent.procedure.congestion", [$this, "onCongestion"]);
     });
     $congestionManager->start(false);
 }