debug
This commit is contained in:
parent
ae24fea621
commit
c5fab07c23
|
|
@ -13,52 +13,57 @@ use Webman\RedisQueue\Redis;
|
||||||
$user = config('cons.mq.user');
|
$user = config('cons.mq.user');
|
||||||
$password = config('cons.mq.password');
|
$password = config('cons.mq.password');
|
||||||
$queue = config('cons.mq.queue_t') . '-apply.sms.temp';
|
$queue = config('cons.mq.queue_t') . '-apply.sms.temp';
|
||||||
define('AMQP_DEBUG', true);
|
|
||||||
|
|
||||||
// 防止空闲时间断线必须设置心跳
|
|
||||||
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
|
||||||
'/',
|
|
||||||
false,
|
|
||||||
'AMQPLAIN',
|
|
||||||
null,
|
|
||||||
'en_US',
|
|
||||||
60,
|
|
||||||
60,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
30
|
|
||||||
);
|
|
||||||
$rabbit_channel = $connection->channel();
|
|
||||||
$rabbit_channel->queue_declare($queue, false, true, false, false, false, [
|
|
||||||
// 'x-message-ttl' => ['I', 180000]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$callback = function ($msg) use ($queue){
|
try {
|
||||||
$data = $msg->body;
|
define('AMQP_DEBUG', true);
|
||||||
Log::info('MQ收到消息[申请新短信模版/营销短信发送/微信模版消息]--->' . $data . "\n");
|
// 防止空闲时间断线必须设置心跳
|
||||||
$arr = explode(',', $data);
|
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
||||||
if(isset($arr[2])) {
|
'/',
|
||||||
$type = $arr[2];
|
false,
|
||||||
if($type == 'applySmsTemp') {
|
'AMQPLAIN',
|
||||||
// 发给队列 短信模版审核
|
null,
|
||||||
$a = Redis::send('apply.sms.temp', $data);
|
'en_US',
|
||||||
Log::info('消息队列投递结果----》' . $a);
|
60,
|
||||||
}elseif ($type == 'sendMarkSms') {
|
60,
|
||||||
// 发给队列 营销短信发送
|
null,
|
||||||
Redis::send('send.mark.sms', $data);
|
false,
|
||||||
}elseif ($type == 'sendWechatTemp') {
|
30
|
||||||
// 发给队列 发送微信模版消息
|
);
|
||||||
Redis::send('send.wechat.temp', $data);
|
$rabbit_channel = $connection->channel();
|
||||||
}
|
$rabbit_channel->queue_declare($queue, false, true, false, false);
|
||||||
}else {
|
|
||||||
Log::info('MQ收到消息[申请新短信模版/营销短信发送/微信模版消息]格式错误');
|
$callback = function ($msg) use ($queue){
|
||||||
|
$data = $msg->body;
|
||||||
|
Log::info('MQ收到消息[申请新短信模版/营销短信发送/微信模版消息]--->' . $data . "\n");
|
||||||
|
$arr = explode(',', $data);
|
||||||
|
if(isset($arr[2])) {
|
||||||
|
$type = $arr[2];
|
||||||
|
if($type == 'applySmsTemp') {
|
||||||
|
// 发给队列 短信模版审核
|
||||||
|
$a = Redis::send('apply.sms.temp', $data);
|
||||||
|
Log::info('消息队列投递结果----》' . $a);
|
||||||
|
}elseif ($type == 'sendMarkSms') {
|
||||||
|
// 发给队列 营销短信发送
|
||||||
|
Redis::send('send.mark.sms', $data);
|
||||||
|
}elseif ($type == 'sendWechatTemp') {
|
||||||
|
// 发给队列 发送微信模版消息
|
||||||
|
Redis::send('send.wechat.temp', $data);
|
||||||
}
|
}
|
||||||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
}else {
|
||||||
};
|
Log::info('MQ收到消息[申请新短信模版/营销短信发送/微信模版消息]格式错误');
|
||||||
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
|
||||||
while ($rabbit_channel->is_consuming()) {
|
|
||||||
Log::info('apply.sms.temp-MQ准备调用wait');
|
|
||||||
$rabbit_channel->wait();
|
|
||||||
}
|
}
|
||||||
$rabbit_channel->close();
|
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||||
$connection->close();
|
};
|
||||||
|
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
||||||
|
while ($rabbit_channel->is_consuming()) {
|
||||||
|
Log::info('apply.sms.temp-MQ准备调用wait');
|
||||||
|
$rabbit_channel->wait();
|
||||||
|
}
|
||||||
|
$rabbit_channel->close();
|
||||||
|
$connection->close();
|
||||||
|
}catch (Exception $exception) {
|
||||||
|
Log::info('apply.sms.temp-MQ错误' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,44 +7,48 @@ use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
use Webman\RedisQueue\Redis;
|
use Webman\RedisQueue\Redis;
|
||||||
|
|
||||||
// 生日有礼
|
|
||||||
define('AMQP_DEBUG', true);
|
|
||||||
$host = config('cons.mq.host');
|
|
||||||
$port = config('cons.mq.port');
|
|
||||||
$user = config('cons.mq.user');
|
|
||||||
$password = config('cons.mq.password');
|
|
||||||
$queue = config('cons.mq.queue_t') . '-birthday.gift.sms';
|
|
||||||
|
|
||||||
// 防止空闲时间断线必须设置心跳
|
try {
|
||||||
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
// 生日有礼
|
||||||
'/',
|
define('AMQP_DEBUG', true);
|
||||||
false,
|
$host = config('cons.mq.host');
|
||||||
'AMQPLAIN',
|
$port = config('cons.mq.port');
|
||||||
null,
|
$user = config('cons.mq.user');
|
||||||
'en_US',
|
$password = config('cons.mq.password');
|
||||||
60,
|
$queue = config('cons.mq.queue_t') . '-birthday.gift.sms';
|
||||||
60,
|
|
||||||
null,
|
// 防止空闲时间断线必须设置心跳
|
||||||
false,
|
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
||||||
30
|
'/',
|
||||||
);
|
false,
|
||||||
$rabbit_channel = $connection->channel();
|
'AMQPLAIN',
|
||||||
$rabbit_channel->queue_declare($queue, false, true, false, false, false, [
|
null,
|
||||||
// 'x-message-ttl' => ['I', 180000]
|
'en_US',
|
||||||
]);
|
60,
|
||||||
|
60,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
30
|
||||||
|
);
|
||||||
|
$rabbit_channel = $connection->channel();
|
||||||
|
$rabbit_channel->queue_declare($queue, false, true, false, false);
|
||||||
|
|
||||||
|
$callback = function ($msg) use ($queue){
|
||||||
|
$date_time = date('Y-m-d H:i:s');
|
||||||
|
$data = $msg->body;
|
||||||
|
Log::info('MQ收到消息[生日有礼]--->' . $data . '--->' . $date_time . "\n");
|
||||||
|
// 发给队列
|
||||||
|
Redis::send('birthday.gift.sms', $data);
|
||||||
|
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||||
|
};
|
||||||
|
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
||||||
|
while ($rabbit_channel->is_consuming()) {
|
||||||
|
Log::info('birthday.gift.sms-MQ准备调用wait');
|
||||||
|
$rabbit_channel->wait();
|
||||||
|
}
|
||||||
|
$rabbit_channel->close();
|
||||||
|
$connection->close();
|
||||||
|
}catch (Exception $exception) {
|
||||||
|
Log::info('birthday.gift.sms-MQ错误' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
$callback = function ($msg) use ($queue){
|
|
||||||
$date_time = date('Y-m-d H:i:s');
|
|
||||||
$data = $msg->body;
|
|
||||||
Log::info('MQ收到消息[生日有礼]--->' . $data . '--->' . $date_time . "\n");
|
|
||||||
// 发给队列
|
|
||||||
Redis::send('birthday.gift.sms', $data);
|
|
||||||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
|
||||||
};
|
|
||||||
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
|
||||||
while ($rabbit_channel->is_consuming()) {
|
|
||||||
Log::info('birthday.gift.sms-MQ准备调用wait');
|
|
||||||
$rabbit_channel->wait();
|
|
||||||
}
|
|
||||||
$rabbit_channel->close();
|
|
||||||
$connection->close();
|
|
||||||
|
|
|
||||||
|
|
@ -13,94 +13,102 @@ use support\Log;
|
||||||
$user = config('cons.mq.user');
|
$user = config('cons.mq.user');
|
||||||
$password = config('cons.mq.password');
|
$password = config('cons.mq.password');
|
||||||
$queue = config('cons.mq.queue_t') . '-order.print.queue';
|
$queue = config('cons.mq.queue_t') . '-order.print.queue';
|
||||||
define('AMQP_DEBUG', true);
|
|
||||||
// 防止空闲时间断线必须设置心跳
|
|
||||||
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
|
||||||
'/',
|
|
||||||
false,
|
|
||||||
'AMQPLAIN',
|
|
||||||
null,
|
|
||||||
'en_US',
|
|
||||||
60,
|
|
||||||
60,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
30
|
|
||||||
);
|
|
||||||
$rabbit_channel = $connection->channel();
|
|
||||||
$rabbit_channel->queue_declare($queue, false, true, false, false, false, [
|
|
||||||
'x-message-ttl' => ['I', 180000]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$callback = function ($msg) use ($queue){
|
|
||||||
$date_time = date('Y-m-d H:i:s');
|
try {
|
||||||
$data = $msg->body;
|
define('AMQP_DEBUG', true);
|
||||||
Log::info('MQ收到消息[订单打印]--->' . $data . '--->' . $date_time . "\n");
|
// 防止空闲时间断线必须设置心跳
|
||||||
// 如果是数字。则打印订单
|
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
||||||
$is_log = false;
|
'/',
|
||||||
$curl_error = '';
|
false,
|
||||||
print_r($data . "\r\n");
|
'AMQPLAIN',
|
||||||
$order_id_t = strpos($data, '_');
|
null,
|
||||||
print_r($order_id_t . "嘿嘿\r\n");
|
'en_US',
|
||||||
if($order_id_t !== false) {
|
60,
|
||||||
print_r($order_id_t . "\r\n");
|
60,
|
||||||
$order_id = substr($data, 0, $order_id_t);
|
null,
|
||||||
}else {
|
false,
|
||||||
print_r( "无下划线\r\n");
|
30
|
||||||
$order_id = $data;
|
);
|
||||||
}
|
$rabbit_channel = $connection->channel();
|
||||||
print_r($order_id . "\r\n");
|
$rabbit_channel->queue_declare($queue, false, true, false, false, false, [
|
||||||
$order = Db::table('tb_order_info')->where(['id' => $order_id])->find();
|
'x-message-ttl' => ['I', 180000]
|
||||||
if($order) {
|
]);
|
||||||
$rand = 'cashier_order' . Random::build();
|
|
||||||
$send_id = 'cashier_'. $order['shop_id'];
|
$callback = function ($msg) use ($queue){
|
||||||
// 收银机打印订单
|
$date_time = date('Y-m-d H:i:s');
|
||||||
$snd_data = [
|
$data = $msg->body;
|
||||||
'msg' => '收银机订单打印',
|
Log::info('MQ收到消息[订单打印]--->' . $data . '--->' . $date_time . "\n");
|
||||||
'type' => 'cashier',
|
// 如果是数字。则打印订单
|
||||||
'operate_type' => 'order_print',
|
$is_log = false;
|
||||||
'data_type' => 'order',
|
$curl_error = '';
|
||||||
'status' => 1,
|
print_r($data . "\r\n");
|
||||||
'method' => 'sendToUid',
|
$order_id_t = strpos($data, '_');
|
||||||
'send_num' => 0,
|
print_r($order_id_t . "嘿嘿\r\n");
|
||||||
'send_id' => $send_id,
|
if($order_id_t !== false) {
|
||||||
'msg_id' => $rand,
|
print_r($order_id_t . "\r\n");
|
||||||
'data' => $data
|
$order_id = substr($data, 0, $order_id_t);
|
||||||
];
|
}else {
|
||||||
$snd_data_json = json_encode($snd_data);
|
print_r( "无下划线\r\n");
|
||||||
// 内部给收银机推送打订单
|
$order_id = $data;
|
||||||
$url = 'http://127.0.0.1:8686/?method=sendToUid&account='. $send_id .'¶ms=' . $snd_data_json; // 替换为你的服务地址和端口
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
$output = curl_exec($ch);
|
|
||||||
if (curl_errno($ch)) {
|
|
||||||
$is_log = true;
|
|
||||||
$curl_error = 'Curl error: ' . curl_error($ch);
|
|
||||||
}
|
|
||||||
curl_close($ch);
|
|
||||||
Log::info('内部通讯结果(订单打印)--->' . $output . '通讯ID--->cashier_' .$order['shop_id']. '---' . date('Y-m-d H:i:s') . "\n");
|
|
||||||
}else {
|
|
||||||
$curl_error = 'order Data is empty';
|
|
||||||
$is_log = true;
|
|
||||||
}
|
|
||||||
if($is_log) {
|
|
||||||
Db::table('tb_mq_log')->insert([
|
|
||||||
'queue' => $queue,
|
|
||||||
'msg' => $data,
|
|
||||||
'type' => 'orderPrint',
|
|
||||||
'plat' => 'Cashier',
|
|
||||||
'create_time' => date('Y-m-d H:i:s'),
|
|
||||||
'fail_time' => date('Y-m-d H:i:s'),
|
|
||||||
'err_info' => $curl_error,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
|
||||||
};
|
|
||||||
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
|
||||||
while ($rabbit_channel->is_consuming()) {
|
|
||||||
Log::info('order.print.queue-MQ准备调用wait');
|
|
||||||
$rabbit_channel->wait();
|
|
||||||
}
|
}
|
||||||
$rabbit_channel->close();
|
print_r($order_id . "\r\n");
|
||||||
$connection->close();
|
$order = Db::table('tb_order_info')->where(['id' => $order_id])->find();
|
||||||
|
if($order) {
|
||||||
|
$rand = 'cashier_order' . Random::build();
|
||||||
|
$send_id = 'cashier_'. $order['shop_id'];
|
||||||
|
// 收银机打印订单
|
||||||
|
$snd_data = [
|
||||||
|
'msg' => '收银机订单打印',
|
||||||
|
'type' => 'cashier',
|
||||||
|
'operate_type' => 'order_print',
|
||||||
|
'data_type' => 'order',
|
||||||
|
'status' => 1,
|
||||||
|
'method' => 'sendToUid',
|
||||||
|
'send_num' => 0,
|
||||||
|
'send_id' => $send_id,
|
||||||
|
'msg_id' => $rand,
|
||||||
|
'data' => $data
|
||||||
|
];
|
||||||
|
$snd_data_json = json_encode($snd_data);
|
||||||
|
// 内部给收银机推送打订单
|
||||||
|
$url = 'http://127.0.0.1:8686/?method=sendToUid&account='. $send_id .'¶ms=' . $snd_data_json; // 替换为你的服务地址和端口
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
$output = curl_exec($ch);
|
||||||
|
if (curl_errno($ch)) {
|
||||||
|
$is_log = true;
|
||||||
|
$curl_error = 'Curl error: ' . curl_error($ch);
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
Log::info('内部通讯结果(订单打印)--->' . $output . '通讯ID--->cashier_' .$order['shop_id']. '---' . date('Y-m-d H:i:s') . "\n");
|
||||||
|
}else {
|
||||||
|
$curl_error = 'order Data is empty';
|
||||||
|
$is_log = true;
|
||||||
|
}
|
||||||
|
if($is_log) {
|
||||||
|
Db::table('tb_mq_log')->insert([
|
||||||
|
'queue' => $queue,
|
||||||
|
'msg' => $data,
|
||||||
|
'type' => 'orderPrint',
|
||||||
|
'plat' => 'Cashier',
|
||||||
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
|
'fail_time' => date('Y-m-d H:i:s'),
|
||||||
|
'err_info' => $curl_error,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||||
|
};
|
||||||
|
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
||||||
|
while ($rabbit_channel->is_consuming()) {
|
||||||
|
Log::info('order.print.queue-MQ准备调用wait');
|
||||||
|
$rabbit_channel->wait();
|
||||||
|
}
|
||||||
|
$rabbit_channel->close();
|
||||||
|
$connection->close();
|
||||||
|
}catch (Exception $exception) {
|
||||||
|
Log::info('order.print.queue-MQ错误' . $exception->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,83 +8,85 @@ use PhpAmqpLib\Connection\AMQPStreamConnection;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
|
|
||||||
define('AMQP_DEBUG', true);
|
try {
|
||||||
$host = config('cons.mq.host');
|
define('AMQP_DEBUG', true);
|
||||||
$port = config('cons.mq.port');
|
$host = config('cons.mq.host');
|
||||||
$user = config('cons.mq.user');
|
$port = config('cons.mq.port');
|
||||||
$password = config('cons.mq.password');
|
$user = config('cons.mq.user');
|
||||||
$queue = config('cons.mq.queue_t') . '-product.info.change.queue';
|
$password = config('cons.mq.password');
|
||||||
// 防止空闲时间断线必须设置心跳
|
$queue = config('cons.mq.queue_t') . '-product.info.change.queue';
|
||||||
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
// 防止空闲时间断线必须设置心跳
|
||||||
'/',
|
$connection = new AMQPStreamConnection($host, $port, $user, $password,
|
||||||
false,
|
'/',
|
||||||
'AMQPLAIN',
|
false,
|
||||||
null,
|
'AMQPLAIN',
|
||||||
'en_US',
|
null,
|
||||||
60,
|
'en_US',
|
||||||
60,
|
60,
|
||||||
null,
|
60,
|
||||||
false,
|
null,
|
||||||
30
|
false,
|
||||||
);
|
30
|
||||||
$rabbit_channel = $connection->channel();
|
);
|
||||||
$rabbit_channel->queue_declare($queue, false, true, false, false, false, [
|
$rabbit_channel = $connection->channel();
|
||||||
// 'x-message-ttl' => ['I', 180000]
|
$rabbit_channel->queue_declare($queue, false, true, false, false);
|
||||||
]);
|
|
||||||
|
|
||||||
$callback = function ($msg) use ($queue){
|
$callback = function ($msg) use ($queue){
|
||||||
$date_time = date('Y-m-d H:i:s');
|
$date_time = date('Y-m-d H:i:s');
|
||||||
$data = $msg->body;
|
$data = $msg->body;
|
||||||
Log::info('MQ收到消息[商品更新]--->' . $data . '--->' . $date_time . "\n");
|
Log::info('MQ收到消息[商品更新]--->' . $data . '--->' . $date_time . "\n");
|
||||||
// 如果是数字。则打印订单
|
// 如果是数字。则打印订单
|
||||||
$is_log = false;
|
$is_log = false;
|
||||||
$curl_error = '';
|
$curl_error = '';
|
||||||
if(is_numeric($data)) {
|
if(is_numeric($data)) {
|
||||||
$rand = 'product_update' . Random::build();
|
$rand = 'product_update' . Random::build();
|
||||||
$send_id = 'product_update'. $data;
|
$send_id = 'product_update'. $data;
|
||||||
$method = 'sendToGroup';
|
$method = 'sendToGroup';
|
||||||
$snd_data = [
|
$snd_data = [
|
||||||
'msg' => '商品更新',
|
'msg' => '商品更新',
|
||||||
'type' => 'product',
|
'type' => 'product',
|
||||||
'operate_type' => 'product_update',
|
'operate_type' => 'product_update',
|
||||||
'data_type' => 'product_update',
|
'data_type' => 'product_update',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'method' => $method,
|
'method' => $method,
|
||||||
'send_num' => 0,
|
'send_num' => 0,
|
||||||
'send_id' => $send_id,
|
'send_id' => $send_id,
|
||||||
'msg_id' => $rand,
|
'msg_id' => $rand,
|
||||||
'data' => $data
|
'data' => $data
|
||||||
];
|
];
|
||||||
$snd_data_json = json_encode($snd_data);
|
$snd_data_json = json_encode($snd_data);
|
||||||
$url = 'http://127.0.0.1:8686/?method=' . $method . '&account='. $send_id .'¶ms=' . $snd_data_json; // 替换为你的服务地址和端口
|
$url = 'http://127.0.0.1:8686/?method=' . $method . '&account='. $send_id .'¶ms=' . $snd_data_json; // 替换为你的服务地址和端口
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
$output = curl_exec($ch);
|
$output = curl_exec($ch);
|
||||||
if (curl_errno($ch)) {
|
if (curl_errno($ch)) {
|
||||||
$is_log = true;
|
$is_log = true;
|
||||||
$curl_error = 'Curl error: ' . curl_error($ch);
|
$curl_error = 'Curl error: ' . curl_error($ch);
|
||||||
}
|
}
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
Log::info('内部通讯结果(商品更新)--->' . $output . '通讯ID--->shop_id-->' .$send_id. '---' . date('Y-m-d H:i:s') . "\n");
|
Log::info('内部通讯结果(商品更新)--->' . $output . '通讯ID--->shop_id-->' .$send_id. '---' . date('Y-m-d H:i:s') . "\n");
|
||||||
if($is_log) {
|
if($is_log) {
|
||||||
Db::table('tb_mq_log')->insert([
|
Db::table('tb_mq_log')->insert([
|
||||||
'queue' => $queue,
|
'queue' => $queue,
|
||||||
'msg' => $data,
|
'msg' => $data,
|
||||||
'type' => 'product_update',
|
'type' => 'product_update',
|
||||||
'plat' => 'product',
|
'plat' => 'product',
|
||||||
'create_time' => date('Y-m-d H:i:s'),
|
'create_time' => date('Y-m-d H:i:s'),
|
||||||
'fail_time' => date('Y-m-d H:i:s'),
|
'fail_time' => date('Y-m-d H:i:s'),
|
||||||
'err_info' => $curl_error,
|
'err_info' => $curl_error,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||||
|
};
|
||||||
|
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
||||||
|
while ($rabbit_channel->is_consuming()) {
|
||||||
|
Log::info('product.info.change.queue-MQ准备调用wait');
|
||||||
|
$rabbit_channel->wait();
|
||||||
}
|
}
|
||||||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
$rabbit_channel->close();
|
||||||
};
|
$connection->close();
|
||||||
$rabbit_channel->basic_consume($queue, '', false, false, false, false, $callback);
|
}catch (Exception $exception) {
|
||||||
while ($rabbit_channel->is_consuming()) {
|
Log::info('product.info.change.queue-MQ错误' . $exception->getMessage());
|
||||||
Log::info('product.info.change.queue-MQ准备调用wait');
|
|
||||||
$rabbit_channel->wait();
|
|
||||||
}
|
}
|
||||||
$rabbit_channel->close();
|
|
||||||
$connection->close();
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue