Esempio n. 1
0
 /**
  * Main work method.
  * Loops indefinitely unless interrupted. Note that the MySQL connection might time out if no relevant data is
  * received over longer periods, EvE downtimes, for instance.
  * 
  * @return void
  */
 public function run()
 {
     if (VERBOSE) {
         echo "Starting EMDR data stream" . PHP_EOL;
     }
     //init ZMQ
     $context = new \ZMQContext();
     $subscriber = $context->getSocket(\ZMQ::SOCKET_SUB);
     //Connect to EMDR relay.
     $subscriber->connect(\iveeCore\Config::getEmdrRelayUrl());
     // Disable filtering.
     $subscriber->setSockOpt(\ZMQ::SOCKOPT_SUBSCRIBE, "");
     if (VERBOSE) {
         echo "Processing EMDR data" . PHP_EOL;
     }
     //main loop
     while (true) {
         // Receive raw market JSON strings and un-serialize
         $this->handleMarketData(json_decode(gzuncompress($subscriber->recv())));
     }
 }