Jelajahi Sumber

Merge branch 'stats_command#1' into 'master'

Stats command#1

See merge request interlink-sa/flowdat3/modules/stats_command!4
Jean Sumara Leopoldo 5 tahun lalu
induk
melakukan
3935ff46cb
1 mengubah file dengan 4 tambahan dan 6 penghapusan
  1. 4 6
      src/App/Listener/StatsConsumerListener.php

+ 4 - 6
src/App/Listener/StatsConsumerListener.php

@@ -19,11 +19,10 @@ class StatsConsumerListener
     }
 
     public function run(){
-        echo 'Running listener';
+        echo 'Running listener'.PHP_EOL;
 
         $callbackMessage = function($msg) {
             $msgBody = unserialize($msg->body);
-
             if (isset($msgBody['name']) && isset($msgBody['args'])) {
                 // command name and args
                 $name = $msgBody['name'];
@@ -52,6 +51,7 @@ class StatsConsumerListener
                 }
 
                 try {
+                    echo "Executing the command {$execute}".PHP_EOL;
                     $process = new Process($execute);
                     $process->setTimeout(60 * 10);
                     $process->run();
@@ -63,14 +63,12 @@ class StatsConsumerListener
                 } catch (\Exception $e) {
                     echo 'KILL COMMAND: ',  $e->getMessage(), "\n";
                 }
-                return true;
             }
 
-            return false;
         };
 
-        $this->channelAMQP->queue_declare('command.stats', false, true ,false, false);
-        $this->channelAMQP->basic_consume('command.stats', '', false, true, false, false, $callbackMessage);
+        $this->channelAMQP->queue_declare('command_stats', false, true ,false, false);
+        $this->channelAMQP->basic_consume('command_stats', 'command_stats', false, true, false, false, $callbackMessage);
 
         while (count($this->channelAMQP->callbacks)){
             try {