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


PHP msg_stat_queue函数代码示例

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


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

示例1: __construct

 public function __construct(Config $config)
 {
     $this->ownerPid = $config->get('ownerPid');
     $this->ipcKey = new IpcKey($this->ownerPid, str_replace('\\', '_', get_class($this)));
     $this->id = msg_get_queue($this->ipcKey->generate());
     $this->stat = msg_stat_queue($this->id);
 }
开发者ID:ackintosh,项目名称:snidel,代码行数:7,代码来源:AbstractQueue.php

示例2: mqPeek

 /**
     Peek at a Message Queue Return the Number of Messages
 */
 static function mqPeek($name)
 {
     $mq = msg_get_queue(self::_ftok($name));
     $stat = msg_stat_queue($mq);
     return $stat['msg_qnum'];
     // Items in the Queue
 }
开发者ID:edoceo,项目名称:radix,代码行数:10,代码来源:IPC.php

示例3: fillQueueGeneralInformation

 private function fillQueueGeneralInformation()
 {
     $status = msg_stat_queue($this->resource);
     $this->ownerId = $status['msg_perm.uid'];
     $this->ownerGroupId = $status['msg_perm.gid'];
     $this->messageAllowedSize = $status['msg_qbytes'];
 }
开发者ID:marcusesa,项目名称:microqueue,代码行数:7,代码来源:Queue.php

示例4: count

 /**
  * {@inheritdoc}
  */
 public function count()
 {
     $data = msg_stat_queue($this->getQueue());
     if (!is_array($data)) {
         throw new QueueException($this, 'Failed to get the meta data for the queue.');
     }
     return $data['msg_qnum'];
 }
开发者ID:rybakit,项目名称:phive-queue,代码行数:11,代码来源:SysVQueue.php

示例5: 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

示例6: 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

示例7: initQueue

 public static function initQueue($queue_file)
 {
     if (!file_exists($queue_file)) {
         touch($queue_file);
     }
     $msg_id = msg_get_queue(ftok($queue_file, 'r'), 0666);
     // Remove any messages in queue
     $queue = msg_stat_queue($msg_id);
     if ($queue['msg_qnum'] > 0) {
         msg_remove_queue($msg_id);
         $msg_id = msg_get_queue(ftok($queue_file, 'r'), 0666);
     }
     return $msg_id;
 }
开发者ID:blamh,项目名称:ipc_mailbox,代码行数:14,代码来源:Receiver.php

示例8: showAllDaemon

 private function showAllDaemon()
 {
     $messageQueueKey = ftok(App::path('cache') . "/queue/daemon.queue", "a");
     $messageQueue = msg_get_queue($messageQueueKey, 0666);
     $messageQueueState = msg_stat_queue($messageQueue);
     $msgCount = $messageQueueState['msg_qnum'];
     if (0 === $msgCount) {
         Console::line("None service is running.");
     }
     while ($msgCount > 0) {
         /** @var MessageQueue $message */
         msg_receive($messageQueue, 0, $messageType, 1024, $message, true, MSG_IPC_NOWAIT);
         Console::line("PID:{$message->pid},NAME:{$message->name},TIME:" . date("Y-m-d H:i:s", $message->timestamp) . "Alive.");
         $messageQueueState = msg_stat_queue($messageQueue);
         $msgCount = $messageQueueState['msg_qnum'];
     }
 }
开发者ID:sanzhumu,项目名称:xaircraft1.1,代码行数:17,代码来源:ServiceCommand.php

示例9: __destruct

 /**
  * The class destructor.
  */
 public function __destruct()
 {
     parent::__destruct();
     if ($this->iAmParent()) {
         $desiredType = 1;
         $option_receive = MSG_IPC_NOWAIT;
         $stats = msg_stat_queue($this->queueResourceResponse);
         $queueMessageSize = $stats['msg_qbytes'];
         // the Report
         $messageReport = '';
         // receive the report
         $stats = msg_stat_queue($this->queueResourceResponse);
         while ($stats['msg_qnum']) {
             //for($i=0;count($all_servers);$i++){
             $status = msg_receive($this->queueResourceResponse, $desiredType, $type, $queueMessageSize, $mixed, true, $option_receive);
             if ($status == true) {
                 $messageReport .= $mixed['message'];
                 if ($mixed['return'] < 0) {
                     // check if server counldn't do the backups because shutdown doesn't work
                     if ($mixed['error'] && $mixed['error']['error']['error'] == '_ERR_VM_BACKUP_STILL_RUNNING_') {
                         $etva_server = $mixed['server'];
                         $this->log("[WARN] Receive error that VM '" . $etva_server->getName() . "' couldn't make backup beacuse is still running, so i will try start again...");
                         $etva_node = $etva_server->getEtvaNode();
                         if ($etva_node) {
                             $res_start = $etva_node->soapSend(EtvaServer_VA::SERVER_START, array('uuid' => $etva_server->getUuid(), 'name' => $etva_server->getName()));
                             $this->log("[WARN] Start '" . $etva_server->getName() . "' VM and receive the following message: " . print_r($res_start, true));
                         }
                     }
                 }
             } else {
                 $err_m = "[ERROR] Receive error when wait for response... " . print_r($err, true);
                 $messageReport .= $err_m . "\r\n";
                 $this->log($err_m);
             }
             $stats = msg_stat_queue($this->queueResourceResponse);
         }
         msg_remove_queue($this->queueResourceResponse);
         //$this->log($messageReport);
         $this->sendReport($messageReport);
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:44,代码来源:nodeBackupserversTask.class.php

示例10: count

 /**
  * {@inheritdoc}
  */
 public function count()
 {
     $stat = msg_stat_queue($this->queue);
     return $stat['msg_qnum'];
 }
开发者ID:Nik-ADA,项目名称:concurrent,代码行数:8,代码来源:PosixSemaphore.php

示例11: define

<?php

// link: http://www.ebrueggeman.com/blog/creating-a-message-queue-in-php
// filename: add_to_queue.php
//creating a queue requires we come up with an arbitrary number
define('QUEUE', 21671);
//add message to queue
$queue = msg_get_queue(QUEUE);
// Create dummy message object
$object = new stdclass();
$object->name = 'foo';
$object->id = uniqid();
$object->data = array('name' => 'Ligia');
//try to add message to queue
if (msg_send($queue, 1, $object)) {
    echo "added to queue  \n";
    // you can use the msg_stat_queue() function to see queue status
    print_r(msg_stat_queue($queue));
} else {
    echo "could not add message to queue \n";
}
开发者ID:josue,项目名称:zilla-queues,代码行数:21,代码来源:send.php

示例12: stats

 public function stats()
 {
     return msg_stat_queue($this->queue);
 }
开发者ID:jovination,项目名称:phork,代码行数:4,代码来源:Channel.php

示例13: json_decode

$json = json_decode(file_get_contents($file));
foreach ($json->queue as $queue) {
    ?>
	<tr>
		<td><?php 
    echo $queue;
    ?>
</td>
		<td>
			<?php 
    if (msg_queue_exists($queue)) {
        echo "ON";
    } else {
        echo "OFF";
    }
    ?>
		</td>
		<td>
			<?php 
    if (msg_queue_exists($queue)) {
        $openqueue = msg_get_queue($queue);
        echo msg_stat_queue($openqueue)['msg_qnum'];
    } else {
        echo "---";
    }
    ?>
			
		</td>
	</tr>
<?php 
}
开发者ID:juanber84,项目名称:phpqueue,代码行数:31,代码来源:status.php

示例14: count

 public function count($queueName)
 {
     $stats = msg_stat_queue($this->getQueue($queueName));
     return $stats['msg_qnum'];
 }
开发者ID:riverline,项目名称:worker-bundle,代码行数:5,代码来源:Semaphore.php

示例15: non_blocking_in

 public function non_blocking_in($msg)
 {
     if ($this->closed || !msg_queue_exists($this->key)) {
         return self::CLOSED;
     }
     $shm = new Message();
     $shm->store($msg);
     $error = 0;
     @msg_send($this->ipc, 1, $shm->key(), false, false, $error);
     if (MSG_EAGAIN === $error) {
         $shmAbortedMessage = new Message($shm->key());
         $shmAbortedMessage->destroy();
         return false;
     }
     ++$this->msg_count;
     $first_loop = true;
     do {
         $data = msg_stat_queue($this->ipc);
         if (!$first_loop && 0 == $data['msg_qnum']) {
             break;
         }
         $first_loop = false;
     } while (true);
     return true;
 }
开发者ID:straiway,项目名称:fmt,代码行数:25,代码来源:csp.php


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