/// <summary> /// 重试远程订阅失败回调 /// </summary> /// <param name="subscriber">订阅客户端凭证</param> public void RetryRemoteSubscriptionCallbackFailure(ClientIndetity subscriber) { try { var channel = new SendToClientChannel(Server, Logger); var records = Storage.FindRemoteSubscriptionCallbackFailureRecord(subscriber.PublisherId); foreach (var item in records) { if (channel.SendMesssage(subscriber, item.Content)) { Storage.RemoveRemoteSubscriptionCallbackFailureRecord(item._id); } } } catch (Exception ex) { Task.Factory.StartNew((e) => { var exception = e as Exception; if (exception != null && Logger != null) { Logger.Error("失败消息重试推送时失败!", exception); } }, ex); } }
/// <summary> /// 远程订阅推送回调 /// </summary> /// <param name="descriptions">事件描述</param> /// <param name="content">事件内容</param> public void RemotePublishCallBack(string descriptions, string content) { try { var channel = new SendToClientChannel(Server, Logger); var receivers = Storage.FindSubscribers(AgentId, descriptions); foreach (var item in receivers) { if (!channel.SendMesssage(item, content)) { Storage.AddRemoteSubscriptionCallbackFailureRecord(item.PublisherId, content); } } } catch (Exception ex) { Task.Factory.StartNew((e) => { var exception = e as Exception; if (exception != null && Logger != null) { Logger.Error("远程订阅推送回调时失败!", exception); } }, ex); } }