Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top