protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = $this->app['config'];
     $ironDriver = new IronDriver($this->app);
     // build options
     $options = [];
     $queueType = $config->get('ironmq.queue_type');
     if ($queueType) {
         $options['type'] = $queueType;
     }
     // optional push queue options
     $baseUrl = $config->get('ironmq.push_listener');
     $authToken = $config->get('ironmq.auth_token');
     $success = true;
     $queues = $config->get('queue.queues');
     foreach ($queues as $queue) {
         if ($ironDriver->install($queue, $options, $baseUrl, $authToken)) {
             $output->writeln("Installed '{$queue}'");
         } else {
             $output->writeln("Could not install '{$queue}'");
             $success = false;
         }
     }
     return $success ? 0 : 1;
 }
 public function message($req, $res)
 {
     // verify auth token
     if ($req->query('auth_token') != $this->app['config']->get('ironmq.auth_token')) {
         return $res->setCode(401);
     }
     // parse the message from the request
     $ironDriver = new IronDriver($this->app);
     $message = $ironDriver->buildMessageFromRequest($req);
     // notify the queue listeners of the message
     Queue::receiveMessage($message);
 }