|
|
@@ -52,27 +52,27 @@ class AddAgreementPdf extends Command
|
|
|
|
|
|
public static function notifyAgreement()
|
|
|
{
|
|
|
- $mq_config = Config::get('mq');
|
|
|
- // 连接到RabbitMQ服务
|
|
|
- $connection = new AMQPStreamConnection($mq_config['host'], $mq_config['port'], $mq_config['username'], $mq_config['password'], $mq_config['vhost']);
|
|
|
- $channel = $connection->channel();
|
|
|
- $channel->exchange_declare('add_agreement','topic',true,true,true,false,false);
|
|
|
-
|
|
|
- // 声明队列
|
|
|
- $queue = 'add_agreement';
|
|
|
- $channel->queue_declare($queue, true, true, false, true,false);
|
|
|
-
|
|
|
- //接收消息
|
|
|
- $callback = function($msg) {
|
|
|
- $param = json_decode($msg->body, true);
|
|
|
- self::addPdf($param);
|
|
|
- };
|
|
|
- $channel->basic_consume('add_agreement', '', false, true, false, false, $callback);
|
|
|
- while(count($channel->callbacks)) {
|
|
|
- $channel->wait();
|
|
|
- }
|
|
|
- $channel->close();
|
|
|
- $connection->close();
|
|
|
+// $mq_config = Config::get('mq');
|
|
|
+// // 连接到RabbitMQ服务
|
|
|
+// $connection = new AMQPStreamConnection($mq_config['host'], $mq_config['port'], $mq_config['username'], $mq_config['password'], $mq_config['vhost']);
|
|
|
+// $channel = $connection->channel();
|
|
|
+// $channel->exchange_declare('add_agreement','topic',true,true,true,false,false);
|
|
|
+//
|
|
|
+// // 声明队列
|
|
|
+// $queue = 'add_agreement';
|
|
|
+// $channel->queue_declare($queue, true, true, false, true,false);
|
|
|
+//
|
|
|
+// //接收消息
|
|
|
+// $callback = function($msg) {
|
|
|
+// $param = json_decode($msg->body, true);
|
|
|
+// self::addPdf($param);
|
|
|
+// };
|
|
|
+// $channel->basic_consume('add_agreement', '', false, true, false, false, $callback);
|
|
|
+// while(count($channel->callbacks)) {
|
|
|
+// $channel->wait();
|
|
|
+// }
|
|
|
+// $channel->close();
|
|
|
+// $connection->close();
|
|
|
}
|
|
|
|
|
|
public static function addPdf($param)
|