public function execute(Request $request, Response $response)
 {
     parent::execute($request, $response);
     Logger::info("Starting processing of listener request from {$this->request->getClientIp()}");
     try {
         $this->doIngressSecurity();
         $soapData = $request->getRawRequest();
         $tl = Logger::getTaggedLogger('RawData');
         $tl->info($soapData);
         $response->sendHeaders();
         /* --- Unfortunately because of how PHP handles SOAP requests we cannot do the fully wrapped
         					loop like we could in the REST listener. Instead it is up to the listener itself to
         					do the required call to $this->processMessage( $msg ).
         
         					It is also expected that inside the handle() context that an exception will throw a SOAP
         					fault through $this->server->fault() instead of doing a $response->kill_response() call.
         			*/
         $this->server->setObject($this);
         $this->server->handle($soapData);
         /* We disable output late in the game in case there was a last minute exception that could
         			be handled by the SOAP listener object inside the handle() context. */
         $response->setOutputDisabled();
     } catch (ListenerSecurityException $ex) {
         Logger::notice('Message denied by security policy, death is me.', null, $ex);
         $response->setStatusCode(403, "Not authorized.");
     } catch (\Exception $ex) {
         Logger::error('Listener threw an unknown exception, death is me.', null, $ex);
         $response->setStatusCode(500, "Unknown listener exception.");
     }
     Logger::info('Finished processing listener request');
 }
 public function execute(Request $request, Response $response)
 {
     parent::execute($request, $response);
     Logger::info("Starting processing of listener request from {$this->request->getClientIp()}");
     try {
         $this->doIngressSecurity();
         $msgs = $this->parseEnvelope($request);
         if (is_array($msgs)) {
             foreach ($msgs as $msg) {
                 $this->processMessage($msg);
             }
         }
         $this->ackEnvelope();
     } catch (ListenerSecurityException $ex) {
         Logger::notice('Message denied by security policy, death is me.', null, $ex);
         $response->setStatusCode(403, "Not authorized.");
     } catch (ListenerDataException $ex) {
         Logger::error('Listener received request it could not process, death is me.', null, $ex);
         $response->setStatusCode(500, 'Received data could not be processed.');
     } catch (Core\ConfigurationException $ex) {
         Logger::alert('Some sad panda gave me a bad configuration.', null, $ex);
         $response->setStatusCode(500, "Configuration error.");
     } catch (\Exception $ex) {
         Logger::error('Listener threw an unknown exception, death is me.', null, $ex);
         $response->setStatusCode(500, "Unknown listener exception");
     }
     Logger::info('Finished processing listener request');
 }
 /**
  * Do the actual work of the script.
  */
 public function execute()
 {
     Logger::info('Info log message');
     Logger::debug('Debug log message');
     Logger::notice('Notice...');
     Logger::getTaggedLogger('RawData')->info('This should be tagged RawData');
     Logger::warning('Warning!', array('foo' => 'bar'));
     try {
         $this->throwException();
     } catch (SmashPigException $ex) {
         Logger::error('ERROR!!!!', null, $ex);
     }
 }
 /**
  * Will run all the actions that are loaded (from the 'actions' configuration
  * node) and that are applicable to this message type. Will return true
  * if all actions returned true. Otherwise will return false. This implicitly
  * means that the message will be re-queued if any action fails. Therefore
  * all actions need to be idempotent.
  *
  * @returns bool True if all actions were successful. False otherwise.
  */
 public function runActionChain()
 {
     Logger::info("Received new report from Adyen: {$this->pspReference}. Generated: {$this->eventDate}.", $this->reason);
     $jobQueue = BaseQueueConsumer::getQueue('jobs-adyen');
     if (strpos($this->pspReference, 'settlement_detail_report') === 0) {
         $jobObject = DownloadReportJob::factory($this->merchantAccountCode, $this->reason);
         // FIXME: write queue wrapper to do these next two steps
         SourceFields::addToMessage($jobObject);
         $jobArray = json_decode($jobObject->toJson(), true);
         $jobQueue->push($jobArray);
     } else {
         // We don't know how to handle this report yet
         Logger::notice("Do not know how to handle report with name '{$this->pspReference}'");
     }
     return parent::runActionChain();
 }
 /**
  * Gets the configuration object associated with the current context.
  *
  * Set the configuration using init()
  *
  * Use this instead of Configuration::getDefaultConfig();
  *
  * @return null|Configuration
  */
 public function getConfiguration()
 {
     if ($this->config) {
         return $this->config;
     } else {
         Logger::notice('Context returning default configuration. Probably missing a setConfiguration().', debug_backtrace(null));
         return Configuration::getDefaultConfig();
     }
 }
 /**
  * @param array $message The data
  * @param Exception $ex The problem
  * @param int| null $retryDate If provided, retry after this timestamp
  * @return int ID of message in damaged database
  */
 protected function sendToDamagedStore($message, Exception $ex, $retryDate = null)
 {
     if ($retryDate) {
         Logger::notice('Message not fully baked. Sticking it back in the oven, to ' . "retry at {$retryDate}", $message);
     } else {
         Logger::error('Error processing message, moving to damaged store.', $message, $ex);
     }
     return $this->damagedDb->storeMessage($message, $this->queueName, $ex->getMessage(), $ex->getTraceAsString(), $retryDate);
 }