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; }
public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) { $serviceLogMQ = new \Utill\MQ\restEntryMQ(); $slimApp = $serviceLocator->get('slimApp'); $request = $slimApp->container['request']; $params = $request->params(); $requestHeaderData = $request->headers(); $base = $request->getRootUri(); $path = $request->getResourceUri(); $ip = $request->getIp(); $method = $request->getMethod(); $requestInfoArray = array('content_type' => $request->getContentType(), 'content_charset' => $request->getContentCharset(), 'host_with_port' => $request->getHostWithPort(), 'scheme' => $request->getScheme(), 'referrer' => $request->getReferrer(), 'user_agent' => $request->getUserAgent(), 'is_ajax' => $request->isAjax()); $serviceLogMQ->setChannelProperties(array('queue.name' => \Utill\MQ\abstractMQ::SERVICE_ENTRY_LOG_QUEUE_NAME)); $message = new \Utill\MQ\MessageMQ\MQMessageServiceLog(); $message->setMessageBody(array('message' => 'Rest servis log!', 'log_datetime' => date('Y-m-d G:i:s '), 'pk' => $requestHeaderData['X-Public'], 'pk_temp' => $requestHeaderData['X-Public-Temp'], 'url' => $base, 'path' => $path, 'method' => $method, 'ip' => \Utill\Env\serverVariables::getClientIp(), 'params' => serialize($params), 'type_id' => \Utill\MQ\MessageMQ\MQMessageServiceLog::SERVICE_UPDATE_OPERATION, 'logFormat' => 'database', 'request_info' => json_encode($requestInfoArray))); $message->setMessageProperties(array('delivery_mode' => 2, 'content_type' => 'application/json')); $serviceLogMQ->setMessage($message->setMessage()); $serviceLogMQ->basicPublish(); return $serviceLogMQ; }
/** * 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ı */ 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(); }