0
我在我的门户上插入新闻并在新闻插入数据库时向所有注册的设备发送通知。我有很多注册的设备,所以我希望这些通知在后端发送,以便用户不断插入新闻,并且每个插入的新闻通知都应排队并在后端发送。在后端发送通知。 asp.net
目前我正在插入新闻,然后发送通知。现在问题是,在所有通知发送过程完成之前,我无法插入另一条消息。 我的代码如下─
public void InsertNews()
{
int newsId=insertNewsOnDb();
string msg="My Json String";
DataTable dt=getAllUsers();
foreach(DataRow dr in dt.Rows)// I want this process to run on backend so
{ // it does not affect the processing of
string gcmId=dr["GcmId"]; // inserting news.
sendPushNotification(gcmId,msg);
}
}
我希望推送通知在一个分开的进程中发送,其中所有的请求将被排队并逐个处理。 – VIVEK 2015-03-19 08:08:45