/** * Execute the console command. * * @return mixed */ public function handle() { $callback = function ($_message) { $message = json_decode($_message, true); if (!isset($message["data"])) { logger()->error('There is no content.', $message); return; } $data = $message["data"]; if (isset($data["type"]) && $data["type"] == 'feed') { if (isset($data["id"])) { logger()->debug("Feed id: " . $data["id"]); $this->downloadService->downloadOnlyFeed($data["id"]); } } else { logger()->error("Not downloadable data"); } }; $rabbitMqConnector = new \App\Utils\RabbitMq\RabbitMqConnect(); $rabbitMqConnector->subscibe('amanda_waiting', $callback); }
private function connectToRabbit($callback) { $rb = new \App\Utils\RabbitMq\RabbitMqConnect(); $rb->subscibe("indexer", $callback); }