Ejemplo n.º 1
0
     if (!isParentRunning($parent_pid)) {
         _TimeStampMsg("--- (child {$my_pid}) : EXITING : my parent seems to be died.");
         cleanShutDown();
     }
     // PROCESS CONTROL FUNCTIONS
 } catch (Exception $e) {
     $secs = 3;
     _TimeStampMsg("--- (child {$my_pid}) : Failed to read from Redis. Doing nothing, wait {$secs} seconds and re-try in next cycle.");
     _TimeStampMsg($e->getMessage());
     sleep($secs);
     continue;
 }
 $msg = null;
 $objQueue = array();
 try {
     $msg = $amqHandlerSubscriber->readFrame();
     if ($msg instanceof StompFrame && ($msg->command == "MESSAGE" || array_key_exists('MESSAGE', $msg->headers))) {
         $i++;
         _TimeStampMsg("--- (child {$my_pid}) : processing frame {$i}");
         $objQueue = json_decode($msg->body, true);
         //empty message what to do?? it should not be there, acknowledge and process the next one
         if (empty($objQueue['pid'])) {
             Utils::raiseJsonExceptionError();
             //                _TimeStampMsg( $msg );
             _TimeStampMsg("--- (child {$my_pid}) : found frame but no valid segment found for tm volume analysis: wait 2 seconds");
             $amqHandlerSubscriber->ack($msg);
             sleep(2);
             continue;
         }
     } else {
         //            _TimeStampMsg( "--- (child $my_pid) : no frame found. wait 5 second" );