/** * Calls worker directly. Fallback when beanstalkd not available. * * @param AbstractTube $tube * @param mixed $data Data which will be transformed to json and put into the mq. * @return int job id */ protected function fallBack($tube, $data) { try { $tube->getWorker()->work($data, null, null); } catch (\Exception $e) { $this->logger->emerg($e->getMessage(), $e->getTrace()); } }
/** * Entry point for the Mailgun webhooks * * @param Request $request * @return JsonResponse */ public function log(Request $request) { // lets log the full response just to be sure // but only not in production if (!app()->environment('production')) { $this->logger->addInfo(json_encode($request->request->all())); } try { $responseLogger = LogResponse::create($request); $responseLogger->log(); } catch (ProjectNotSupported $e) { return new JsonResponse(['success' => false, 'errors' => ["The project you've provided could not be found in our records"]], 400); } catch (\Exception $e) { return new JsonResponse(['success' => false, 'errors' => [$e->getMessage()]], 400); } return new JsonResponse(['success' => true]); }
/** * Log a message to the logs. * * @param string $level * @param string $message * @param array $context * @return void */ public function log($level, $message, array $context = array()) { $this->monolog->log($level, $message, $context); }