当前位置: 首页>>代码示例>>PHP>>正文


PHP msg_send函数代码示例

本文整理汇总了PHP中msg_send函数的典型用法代码示例。如果您正苦于以下问题:PHP msg_send函数的具体用法?PHP msg_send怎么用?PHP msg_send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了msg_send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postAction

 public function postAction()
 {
     $line = $_REQUEST['msg'];
     $id = $_REQUEST['id'];
     $msg_id = msg_get_queue($this->_key, 0600);
     die(json_encode(msg_send($msg_id, 1, "{$id}!{$line}", true, true, $msg_err)));
 }
开发者ID:jaredquinn,项目名称:phpTinyFW,代码行数:7,代码来源:Controller.php

示例2: send

 /**
  * @param $strMessage   - message to send to the queue
  * @param $intErrorCode - reference to error-code, which is set in case of error
  *
  * @throw \Exception - if message is not a string
  *
  * @returns (boolean) true, if message was successfully send to queue
  * @returns (boolean) false, if error occured
  *
  * send the given message to the queue. if the message is to big,
  * the sending is blocked, until there is enough space in queue
  * to send the message.
  * 
  * if an error occurs, the parameter $intErrorCode will contain
  * the error-code.
  *
  **/
 public function send($strMessage, &$intErrorCode = null)
 {
     if (!is_string($strMessage)) {
         throw new \Exception("given parameter must be a string");
     }
     return msg_send($this->resQueue, 1, $strMessage, false, true, $intErrorCode);
 }
开发者ID:t-zuehlsdorff,项目名称:asap,代码行数:24,代码来源:SimpleIPC.class.php

示例3: send

 public function send($message, $type = 1)
 {
     if (!@msg_send($this->queue_id, $type, $message, true, false, $err)) {
         throw new Exception("From msg_send: {$err}");
     }
     return true;
 }
开发者ID:blamh,项目名称:ipc_mailbox,代码行数:7,代码来源:Sender.php

示例4: shutdown

 public function shutdown()
 {
     $this->queue = msg_get_queue(ftok($this->file, 'R'), 0777);
     for ($i = 0; $i < $this->numThreads * 2; $i++) {
         msg_send($this->queue, 100 + $i, 'shutdown');
     }
 }
开发者ID:level-2,项目名称:aphplication,代码行数:7,代码来源:Aphplication.php

示例5: log

 public static function log($message, $type = '')
 {
     $contents = trim($message);
     if (!$contents) {
         return false;
     }
     if (empty($type)) {
         $type = 'common';
     }
     $queue = self::getInstance();
     $msg = json_encode(array('msg' => $contents, 'type' => $type));
     msg_send($queue, 1, $msg, false, false, $errorcode);
     $unix_time = time();
     $Y = date("Y", $unix_time);
     $m = date("m", $unix_time);
     $d = date("d", $unix_time);
     $H = date("H", $unix_time);
     $log_dir = self::LC_LOG_PATH . "/" . $type . "/{$Y}/{$m}/{$d}";
     if (!is_dir($log_dir)) {
         @mkdir($log_dir, 0777, true);
     }
     $log = $log_dir . "/" . $type . '.' . $H . '.' . "log";
     file_put_contents($log, "{$contents}\n", FILE_APPEND);
     return true;
 }
开发者ID:hlxabcd,项目名称:log_center,代码行数:25,代码来源:LC_C_PHP_Logger.php

示例6: push

 /**
  * {@inheritdoc}
  */
 public function push($item, $eta = null)
 {
     $eta = QueueUtils::normalizeEta($eta);
     if (!msg_send($this->getQueue(), $eta, $item, $this->serialize, false, $errorCode)) {
         throw new QueueException($this, self::getErrorMessage($errorCode), $errorCode);
     }
 }
开发者ID:rybakit,项目名称:phive-queue,代码行数:10,代码来源:SysVQueue.php

示例7: put

 function put($data)
 {
     $this->init();
     if (!@msg_send($this->seg, 1, serialize($data), false, false, $errno)) {
         throw new Scalr_System_Ipc_Exception($errno ? self::$msgsnd_errors[$errno] : "Cannot send message", $errno);
     }
     return true;
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:8,代码来源:ShmQueue.php

示例8: send

 public function send($message)
 {
     $result = msg_send($this->queue, 1, $message);
     if ($result == False) {
         print "end error" . PHP_EOL;
     }
     return $result;
 }
开发者ID:jovination,项目名称:phork,代码行数:8,代码来源:Channel.php

示例9: mqSend

 /**
     Put a Message Into the Queue
 */
 static function mqSend($name, $type, $mess)
 {
     $mq = msg_get_queue(self::_ftok($name));
     $block = true;
     $error = null;
     if (msg_send($mq, $type, $mess, true, $block, $error)) {
         return true;
     }
 }
开发者ID:edoceo,项目名称:radix,代码行数:12,代码来源:IPC.php

示例10: send

 public function send($data, $block = false, $serialize = false)
 {
     $error = 0;
     $type = 1;
     $r = msg_send($this->msg, $type, $data, $serialize, $block, $error);
     if (!$r) {
     }
     return $r;
 }
开发者ID:heesey,项目名称:epserver,代码行数:9,代码来源:SystemIPC.php

示例11: send

 /**
  * Sends message
  * @param  integer $type
  * @param  string  $msg
  * @return void
  */
 public function send($type, $msg)
 {
     $err = 0;
     if (!msg_send($this->queue, $type, $msg, true, false, $err)) {
         $this->logger->critical("Message of type {$type} not sent: {$err}", (array) $msg);
     } else {
         $this->logger->debug("Message of type {$type} sent", (array) $msg);
     }
 }
开发者ID:shitfSign,项目名称:threads,代码行数:15,代码来源:Queue.php

示例12: putMessage

 public function putMessage(&$message)
 {
     $messageId = $this->storage->saveMessage($message);
     // notify queue via ipc
     $ipcStat = msg_stat_queue($this->ipcChannel);
     if (is_array($ipcStat) && $ipcStat['msg_qnum'] < 5) {
         msg_send($this->ipcChannel, 1, '*', false, false, $ipcError);
     }
     return $messageId;
 }
开发者ID:s0enke,项目名称:dropr,代码行数:10,代码来源:Client.php

示例13: addMessage

 /**
  * addMessage: Given a key, store a new message into our queue.
  *
  * @param $key string - Reference to the message (PK)
  * @param $data array - Some data to pass into the message
  */
 public static function addMessage($key, $data = array())
 {
     # What to send
     $message = new Message($key, $data);
     # Try to send the message
     if (msg_send(self::$queue, QUEUE_TYPE_START, $message)) {
         print_r(msg_stat_queue(self::$queue));
     } else {
         echo "Error adding to the queue";
     }
 }
开发者ID:sergeypavlenko,项目名称:queue,代码行数:17,代码来源:queue.php

示例14: send

 public static function send($queue, $msg = '')
 {
     $queue_id = self::get_queue_id($queue);
     if (!$queue_id) {
         return false;
     }
     $mqueue = self::get_msg_queue($queue_id);
     if (!$mqueue) {
         return false;
     }
     return msg_send($mqueue, 1, $msg, false, false);
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:12,代码来源:Queue.php

示例15: sendMessage

 public function sendMessage($data)
 {
     //Generate a random ID for this request
     $id = rand();
     $message = [$id, $data];
     msg_send($this->queue, $this->serverId, $message, true, false);
     msg_receive($this->queue, $id, $msgtype, 1000000, $msg, true);
     foreach ($msg[0] as $header) {
         header($header);
     }
     return $msg[1];
 }
开发者ID:level-2,项目名称:aphplication,代码行数:12,代码来源:Client.php


注:本文中的msg_send函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。