1
我的问题是:有(通过回调契约通信)一块这样的代码将数据传递到回调函数中,是否保证会收到数据?
private void BroadcastMessage(DataEventArgs e)
{
DataEventHandler temp = DataEvent;
if (temp != null)
{
foreach (DataEventHandler handler in temp.GetInvocationList())
{
handler.BeginInvoke(this, e, EndAsync, null);
}
}
}
和回调合同
interface IDataCallback
{
[OperationContract(IsOneWay = true)]
void EntityUpdateReceived(Entity entity);
[OperationContract(IsOneWay = true)]
void EntitiesUpdateReceived(List<Entity> entities);
[OperationContract(IsOneWay = true)]
void EntityDeleteReceived(Entity entity);
[OperationContract(IsOneWay = true)]
void EntitiesDeleteReceived(List<Entity> entities);
[OperationContract(IsOneWay = true)]
void SendLogOffMessage(string message);
[OperationContract(IsOneWay = true)]
void Logoff();
[OperationContract(IsOneWay = true)]
void UpdatePlan(int userId);
}
我必须保证其信息将被广播到所有客户成功,即使有一些,让我们说网络问题的方式??我的意思是,服务会自动尝试一次又一次地传递消息,直到成功为止,假设客户端始终连接,但在首次交付时出现了一些问题。我问,因为我不知道是否必须编写额外的代码才能保证它 (服务客户端确认消息等)我在app.config中启用了可靠的会话,可靠的会话是否解决了问题?
预先感谢您的回答
谢谢,这消除了我的顾虑并解决了我的问题。我已经通过链接配置了文章中所述的方式(可靠会话的自定义绑定)。我不需要MSMQ,因为在客户端长时间不可用后,我有自己的同步过程,我需要知道的是我是否可以在短期消息传递上进行中继。现在我知道了,再次感谢。 – Tobiasz 2010-09-22 12:34:33