Archived

This forum has been archived. Please start a new discussion on GitHub.

ice_response( true)

Hi,

My application makes 5 asynchronous calls on a proxy.
All of them register callbacks.

At the end the app sends ice_response( true)

The question is: do I need to wait for all callbacks to return and then send ice_response(true) ?

The alternative would be to send ice_response( true) immediately after these async calls. Perhaps this would make sure that will block until all callback are returned?

I tried to look for the answer in the documentation but it is not clear to me - most likely my feeble powers of understanding.

Many thanks,
Ivo

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    I am not 100% sure if I understand what you are describing so please correct me if I am wrong.

    You have an operation which is implemented using AMD and returns a bool and from within this operation you are making 5 calls on a proxy using AMI.

    Your question is when is it ok to call cb->ice_response(true) for the AMD method.

    The answer is that it is depends on your application. Once you call ice_response the caller of your AMD method will get the response.

    If the caller should not get a response until your AMI calls have completed then you should not call ice_response until after they have completed and their callbacks have been notified (not just after the AMI methods have been called). You will have to implement some logic that stores the AMD callback and can detect when all AMI operations are complete.

    If your caller does not care if the AMI calls have completed then you can call ice_response earlier.

    You might want to look at the Ice/async demo for AMD usage example of both immediate and delayed response.

    Again, if I have misunderstood what you are asking, let me know.