-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathread.php
More file actions
35 lines (26 loc) · 838 Bytes
/
Copy pathread.php
File metadata and controls
35 lines (26 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Created by PhpStorm.
* User: Transn
* Date: 2016-11-22
* Time: 12:55
*/
namespace Home;
use Mqueue\TestQueueModel;
include_once 'Mqueue/functions.php';
$e_name='testExchange';//交换机名
$q_name='testQueue';//队列名
$k_route='testKey';//路由key
$qModel = new TestQueueModel();
$qModel->createQueue($q_name);
//阻塞式处理
$qModel->receiveMessage();
//$qModel->createQueue($q_name)->bindExchange($e_name, $k_route)->receiveMessage();
//返回消息队列中获取的消息
//$messages = $qModel->createQueue($q_name)->bindExchange($e_name, $k_route)->returnMessage(2);
$total = $qModel->getTotalNum();
echo $total;
$messages = $qModel->returnMessage(2);
$messages = $qModel->getMessage();
//$messages = $qModel->createQueue($q_name)->bindExchange($e_name, $k_route)->getMessage();
var_dump($messages);