public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
 {
     $exceptionMQ = new \Utill\MQ\restEntryMQ();
     $slimApp = $serviceLocator->get('slimApp');
     $exceptionMQ->setChannelProperties(array('queue.name' => $slimApp->container['settings']['restEntry.rabbitMQ.queue.name']));
     $message = new \Utill\MQ\MessageMQ\MQMessage();
     //$message->setMessageBody(array('testmessage body' => 'test cevap'));
     //$message->setMessageBody($e);
     $message->setMessageBody(array('message' => 'Rest service has been used', 'time' => date('l jS \\of F Y h:i:s A'), 'serial' => $slimApp->container['settings']['request.serial'], 'ip' => \Utill\Env\serverVariables::getClientIp(), 'url' => $slimApp->request()->getUrl(), 'path' => $slimApp->request()->getPath(), 'method' => $slimApp->request()->getMethod(), 'params' => json_encode($slimApp->request()->params()), 'logFormat' => $slimApp->container['settings']['restEntry.rabbitMQ.logging']));
     $message->setMessageProperties(array('delivery_mode' => 2, 'content_type' => 'application/json'));
     $exceptionMQ->setMessage($message->setMessage());
     $exceptionMQ->basicPublish();
     return $exceptionMQ;
 }
 /**
  * message wrapper function
  * @param \Exception $e
  * @author Mustafa Zeynel Dağlı
  */
 public function publishMessage($e = null, array $params = array())
 {
     $exceptionMQ = new \Utill\MQ\hashMacMQ();
     //print_r('---------'.$this->app->container['settings']['hmac.rabbitMQ.queue.name'].'------');
     $exceptionMQ->setChannelProperties(array('queue.name' => $this->app->container['settings']['hmac.rabbitMQ.queue.name']));
     $message = new \Utill\MQ\MessageMQ\MQMessage();
     //$message->setMessageBody(array('testmessage body' => 'test cevap'));
     //$message->setMessageBody($e);
     $message->setMessageBody(array('message' => 'Hash not matched', 'time' => date('l jS \\of F Y h:i:s A'), 'serial' => $this->app->container['settings']['request.serial'], 'ip' => \Utill\Env\serverVariables::getClientIp(), 'logFormat' => $this->app->container['settings']['hmac.rabbitMQ.logging']));
     $message->setMessageProperties(array('delivery_mode' => 2, 'content_type' => 'application/json'));
     $exceptionMQ->setMessage($message->setMessage());
     $exceptionMQ->basicPublish();
 }
 /**
  * message wrapper function
  * @param \Exception $e
  * @author Mustafa Zeynel Dağlı
  * @todo Time zone can be made parametric(a class constant call maybe)
  */
 public function publishMessage($e = null, array $params = array())
 {
     //date_default_timezone_set('Europe/Istanbul');
     $exceptionMQ = new \Utill\MQ\exceptionMQ();
     $exceptionMQ->setChannelProperties(array('queue.name' => $this->app->container['settings']['exceptions.rabbitMQ.queue.name']));
     $message = new \Utill\MQ\MessageMQ\MQMessage();
     $message->setMessageBody(array('message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString(), 'time' => date('l jS \\of F Y h:i:s A'), 'serial' => $this->app->container['settings']['request.serial'], 'logFormat' => $this->app->container['settings']['exceptions.rabbitMQ.logging']));
     //print_r($message->getMesssageBody());
     $message->setMessageProperties(array('delivery_mode' => 2, 'content_type' => 'application/json'));
     $exceptionMQ->setMessage($message->setMessage());
     $exceptionMQ->basicPublish();
     /**
      * Exception loglarını Message queue ve 
      * service manager üzerinden yönetmek için yazılmıştır.
      * @author Mustafa Zeynel Dağlı
      */
     /*$exceptionMQ = $this->app->getMQManager()->get('MQException');
       $exceptionMQ->setChannelProperties(array('queue.name' => $this->container['settings']['restEntry.rabbitMQ.queue.name']));
       $message = new \Utill\MQ\MessageMQ\MQMessage();
       $message->setMessageBody(array('message' => $e->getMessage(), 
                                      'file' => $e->getFile(),
                                      'line' => $e->getLine(),
                                      'trace' => $e->getTraceAsString() ,
                                      'time'  => date('l jS \of F Y h:i:s A'),
                                      'serial' => $this->app->container['settings']['request.serial'],
                                      'logFormat' => $this->app->container['settings']['exceptions.rabbitMQ.logging']));
       $message->setMessageProperties(array('delivery_mode' => 2,
                                            'content_type' => 'application/json'));
       $exceptionMQ->setMessage($message->setMessage());
       $exceptionMQ->basicPublish();*/
 }
Beispiel #4
0
 /**
  * message wrapper function
  * @param \Exception $e
  * @author Mustafa Zeynel Dağlı
  */
 public function publishMessage($object = null, array $params = array())
 {
     $exceptionMQ = new \Utill\MQ\exceptionMQ();
     $exceptionMQ->setChannelProperties(array('queue.name' => $this->exceptionsQueueName));
     $message = new \Utill\MQ\MessageMQ\MQMessage();
     $message->setMessageBody(array('message' => $object->getMessage(), 'file' => $object->getFile(), 'line' => $object->getLine(), 'trace' => $object->getTraceAsString(), 'time' => date('l jS \\of F Y h:i:s A'), 'serial' => $this->serial, 'ip' => \Utill\Env\serverVariables::getClientIp(), 'logFormat' => $this->getExceptionsQueueLogging()));
     $message->setMessageProperties(array('delivery_mode' => 2, 'content_type' => 'application/json'));
     $exceptionMQ->setMessage($message->setMessage());
     $exceptionMQ->basicPublish();
 }
 /**
  * message wrapper function
  * @param \Exception $e
  * @author Mustafa Zeynel Dağlı
  * @todo Time zone can be made parametric(a class constant call maybe)
  */
 public function publishMessage($e = null, array $params = array())
 {
     //date_default_timezone_set('Europe/Istanbul');
     $exceptionMQ = new \Utill\MQ\exceptionMQ();
     $exceptionMQ->setChannelProperties(array('queue.name' => $this->app->container['settings']['exceptions.rabbitMQ.queue.name']));
     $message = new \Utill\MQ\MessageMQ\MQMessage();
     //$message->setMessageBody(array('testmessage body' => 'test cevap'));
     //$message->setMessageBody($e);
     $message->setMessageBody(array('message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString(), 'time' => date('l jS \\of F Y h:i:s A'), 'serial' => $this->app->container['settings']['request.serial'], 'logFormat' => $this->app->container['settings']['exceptions.rabbitMQ.logging']));
     $message->setMessageProperties(array('delivery_mode' => 2, 'content_type' => 'application/json'));
     $exceptionMQ->setMessage($message->setMessage());
     $exceptionMQ->basicPublish();
 }