views:

30

answers:

1

Hello, 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)]
    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

+2  A: 

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.

Marc Gravell
Thank you, that blew away my concerns and solved my issue. I have it configured the way it is said in the article from your link (custom binding with reliable session). I do not need MSMQ because I have my own synchronisation procedure after client's long unavailability, what I needed to know is whether I can relay on short-term message delivery. Now I know, so thanks again.
toby