Commit d2fb461f by 孙龙

同下

parent 6535b39b
......@@ -558,9 +558,10 @@ class MessageApiController extends Controller
$title = $res[0];
unset($res[0]);
},'GBK');
$exchange = 'szliexin_laravel_tasks'; // 交换器,在我理解,如果两个队列使用一个交换器就代表着两个队列是同步的,这个队列里存在的消息,在另一个队列里也会存在
$queue = 'szliexin_message_tasks002'; // 队列名称
$connection = new AMQPStreamConnection('192.168.1.188', '5672', 'guest', 'guest', '/'); // 创建连接
$exchange = Config("website.msg_exchange"); // 交换器,在我理解,如果两个队列使用一个交换器就代表着两个队列是同步的,这个队列里存在的消息,在另一个队列里也会存在
$queue = Config("website.msg_queue"); // 队列名称
$connection = new AMQPStreamConnection(Config("website.rabbitmq.host"),
Config("website.rabbitmq.port"), Config("website.rabbitmq.login"), Config("website.rabbitmq.password"), Config("website.rabbitmq.vhost")); // 创建连接
$channel = $connection->channel();
$channel->queue_declare($queue, false, true, false, false);
$channel->exchange_declare($exchange, 'direct', false, true, false);
......@@ -592,7 +593,7 @@ class MessageApiController extends Controller
$_data['rbmq'] = [
'expire_time'=>time()+3600*2
];
dump($_data);
// dump($_data);
$msg_arr['data'] = $_data;
$msg = new AMQPMessage(json_encode($msg_arr));
$channel->basic_publish($msg, $exchange);
......
......@@ -12,5 +12,17 @@ return [
'data' => env('DATA_DOMAIN', 'message.liexin.com'),
"domain" => "liexin.com"
"domain" => "liexin.com",
"rabbitmq"=>[
'host'=>'192.168.1.188',
'port'=>'5672',
'login'=>'guest',
'password'=>'guest',
'vhost'=>'/'
],
"msg_exchange"=>'szliexin_laravel_tasks',
"msg_queue"=>'sz_batch_send_msg',
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment