Пример #1
0
 private function sendMessageToRabbit($clientId, $feedId, $filename)
 {
     $queueName = 'amanda_download';
     // complete message about downloaded file and
     $data = ["downloadUniqueKey" => $this->downloadUniqueKey, "filename" => $filename, "clientId" => $clientId, "feedId" => $feedId];
     $rabbitConnect = new RabbitMqConnect();
     $rabbitConnect->publish($queueName, $data);
 }
Пример #2
0
 public function run()
 {
     $callback = function ($message) {
         $data = json_decode($message, true);
         if (isset($data["filename"]) && isset($data["feedId"])) {
             $this->parseFeed($data["feedId"], $data["filename"]);
         } else {
             $message = "No content for parsing feed.";
             logger()->error($message, $data);
             $this->notificationService->error("");
         }
     };
     $rabbitMqConnector = new \App\Utils\RabbitMq\RabbitMqConnect();
     $rabbitMqConnector->subscibe('amanda_download', $callback);
 }