开发者

Passing data into a callback, is data guaranteed to be received?

my question is: having a piece of code like that (communication via callback contract)

private void BroadcastMessage(DataEventArgs e)
{
    DataEventHandler temp = DataEvent;

    if (temp != null)
    {
        foreach (DataEventHandler handler in temp.GetInvocationList())
        {
            handler.BeginInvoke(this, e, EndAsync, null);
        }
    }
}

and a callback contract

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)]
    开发者_Go百科void SendLogOffMessage(string message);

    [OperationContract(IsOneWay = true)]
    void Logoff();

    [OperationContract(IsOneWay = true)]
    void UpdatePlan(int userId);
}

Do I have an assurance that the message will be broadcasted to all clients successfully, even if there were some, let's say network problems on the way ?? I mean, does the service automatcially try to deliver the message time after time until it succeeds, assuming the client is connected all the time but there were some problems during first delivery. I am asking because I do not know if I have to write additional code to have it guaranteed (service-client confirmation messages, etc.) I have a reliable session enabled in app.config, does reliable session solves the issue??

Thanks in advance for your answer


It depends on the binding and configuration (for more details see here). And even then, the reliability is non-durable.

If you want something reliable and durable, you might want to look at transactional queues, for example via MSMQ (although numerous queue technologies are available). You might even want to post synchronously to the queue, since you expect it to be available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜