public function indexAction()
 {
     $params = ZendJobQueue::getCurrentJobParams();
     if (isset($params['obj'])) {
         $obj = unserialize(base64_decode($params['obj']));
         if ($obj instanceof ZendServer_JobQueue_Job_Abstract) {
             try {
                 $obj->run();
                 ZendJobQueue::setCurrentJobStatus(ZendJobQueue::OK);
                 exit;
             } catch (Exception $e) {
                 zend_monitor_set_aggregation_hint(get_class($obj) . ': ' . $e->getMessage());
                 zend_monitor_custom_event('Failed Job', $e->getMessage());
             }
         }
     }
     ZendJobQueue::setCurrentJobStatus(ZendJobQueue::FAILED);
     exit;
 }
Exemplo n.º 2
0
 /**
  * Write a message to the log.
  *
  * @param array $event log data event
  * @return void
  */
 protected function doWrite(array $event)
 {
     $priority = $event['priority'];
     $message = $event['message'];
     unset($event['priority'], $event['message']);
     if (!empty($event)) {
         if ($this->isZendServer) {
             // On Zend Server; third argument should be the event
             zend_monitor_custom_event($priority, $message, $event);
         } else {
             // On Zend Platform; third argument is severity -- either
             // 0 or 1 -- and fourth is optional (event)
             // Severity is either 0 (normal) or 1 (severe); classifying
             // notice, info, and debug as "normal", and all others as
             // "severe"
             monitor_custom_event($priority, $message, $priority > 4 ? 0 : 1, $event);
         }
     } else {
         monitor_custom_event($priority, $message);
     }
 }
Exemplo n.º 3
0
 /**
  * Write a record to Zend Monitor
  *
  * @param int $level
  * @param string $message
  * @param array $formatted
  */
 protected function writeZendMonitorCustomEvent($level, $message, $formatted)
 {
     zend_monitor_custom_event($level, $message, $formatted);
 }
Exemplo n.º 4
-1
 /**
  * Create a custom event in Zend Server
  *
  * @param  MvcEvent $e
  * @return void
  */
 public function createCustomEvent(MvcEvent $e)
 {
     // Do nothing if no error in the event
     $error = $e->getError();
     if (empty($error)) {
         return;
     }
     // Do nothing if the result is a response object
     $result = $e->getResult();
     if ($result instanceof Response) {
         return;
     }
     switch ($error) {
         case Application::ERROR_CONTROLLER_NOT_FOUND:
         case Application::ERROR_CONTROLLER_INVALID:
         case Application::ERROR_ROUTER_NO_MATCH:
             // Specifically not handling these
             return;
         case Application::ERROR_EXCEPTION:
         default:
             if (!empty($e)) {
                 $exception = $e->getParam('exception');
                 /* @var $exception \Exception */
                 $message = 'An error occurred during execution: ' . $exception->getMessage();
                 if ($this->isCustomEventByRuleIsEnabled()) {
                     zend_monitor_custom_event_ex('Zend Framework Exception', $message, 'Zend Framework Exception Rule');
                 } elseif ($this->isCustomEventIsEnabled) {
                     zend_monitor_custom_event('Zend Framework Exception', $message);
                 }
             }
     }
 }