Commit b33dc292 authored by 黄奎's avatar 黄奎

页面修改

parent a97c6605
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Edu.Common.Message
{
......@@ -64,18 +65,29 @@ namespace Edu.Common.Message
AppId = Common.Config.PushAppId,
IsRead=0,
};
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
Task.Run(() =>
{
using (IModel channel = conn.CreateModel())
try
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
byte[] buffer = Encoding.UTF8.GetBytes(Common.Plugin.JsonHelper.Serialize(obj));
IBasicProperties properties = channel.CreateBasicProperties();
properties.DeliveryMode = 2;
channel.BasicPublish("", rabbitConfig.QueenName, properties, buffer);
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
{
using (IModel channel = conn.CreateModel())
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
byte[] buffer = Encoding.UTF8.GetBytes(Common.Plugin.JsonHelper.Serialize(obj));
IBasicProperties properties = channel.CreateBasicProperties();
properties.DeliveryMode = 2;
channel.BasicPublish("", rabbitConfig.QueenName, properties, buffer);
}
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SendMessage");
}
});
}
/// <summary>
......
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 to comment