赞
踩
- $connection = new AMQPStreamConnection('192.168.16.111', 5672, 'user', '123456', '/', true);
- $channel = $connection->channel();
-
- $exchange = 'delayed_exchange_test1';
- //交换机类型
- $args = new AMQPTable(['x-delayed-type' => 'fanout']);
- //声明交换机
- $channel->exchange_declare($exchange, 'x-delayed-message', false, true, false, false, false, $args);
-
- $data = 'Hello World at ' . date('Y-m-d H:i:s');
- //'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT消息持久化
- $message = new AMQPMessage($data, ['delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT]);
- $delay = 10000;
- //延时设置
- $headers = new AMQPTable(['x-delay' => $delay]);
- $message->set('application_headers', $he
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。