Ejemplo n.º 1
0
 public function activateService(GloubsterServerInterface $server, Client $stomp)
 {
     $server['monolog']->addInfo('Connected to STOMP Gateway !');
     $server['dispatcher']->emit('stomp-connected', array($server, $stomp));
     $server['stomp-client.started'] = true;
     $server->probeAllSystems();
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function register(GloubsterServerInterface $server)
 {
     $server['redis-client.started'] = false;
     $server['dispatcher']->on('start', function ($server) {
         $redisErrorHandler = function (PredisClient $client, \Exception $e, PredisConnection $conn) use($server) {
             call_user_func(array($server, 'logError'), $e);
         };
         $redisOptions = array('on_error' => $redisErrorHandler, 'eventloop' => $server['loop']);
         $server['redis-client'] = new PredisClient(sprintf('tcp://%s:%s', $server['configuration']['redis-server']['host'], $server['configuration']['redis-server']['port']), $redisOptions);
         $server['redis-client']->connect(function ($client, $conn) use($server) {
             $server['monolog']->addInfo('Connected to Redis Server !');
             $server['dispatcher']->emit('redis-connected', array($server, $client, $conn));
             $server['redis-client.started'] = true;
             $server->probeAllSystems();
         });
         $server['monolog']->addInfo('Connecting to Redis server...');
     });
     $server['dispatcher']->on('stop', function ($server) {
         $server['redis-client']->disconnect();
         $server['redis-client.started'];
         $server['monolog']->addInfo('Redis Server shutdown');
     });
 }