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