Archived

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

Question about AMI

hi, there,
If I define a slice like this:

module test
{
["ami"] bool foo();
}

then a function will be produced: void foo_async(....),
1) This invocation is one-way , isn't it?
2) For sequentially-sent AMIs, it is not guaranteed that the dispatches in server will not be out-of-order since these AMIs are one way.


TIA

OrNot

Comments

  • No, an AMI call is inherently twoway. You first send the request, and later receive the response in a callback. If it would be oneway, there would be no response.

    Sequential AMI calls, i.e., if you send one AMI call, wait for the callback, then send the next AMI call, are dispatched in order, just like regular twoway calls. Non-sequential AMI calls, i.e., if you send one AMI call after another without first waiting for the first AMI call to complete with a callback, can be dispatched out of order, provided that you use more than one thread in the thread pool.
  • hi,Marc,
    Can I understand :
    the foo_async() will soon return to the caller thread as soon as it puts the data into the socket stack and without needing the acknowledgment from server, which acts like oneway invocation . That is, the
    caller doesn't know the exact time the data is delivered on the wire and the invocation is dispatched in server .
  • OrNot wrote:
    the foo_async() will soon return to the caller thread as soon as it puts the data into the socket stack and without needing the acknowledgment from server

    Right. The Ice run time simply writes the request to the corresponding socket and returns control to the caller immediately. Any errors that might occur when the data is sent or when the reply is unmarshaled are notified via the ice_exception callback.
    which acts like oneway invocation

    Not quite. For a oneway invocation, the caller is not notified of errors whereas, for an AMI invocation, the call is notified of errors.
    That is, the caller doesn't know the exact time the data is delivered on the wire and the invocation is dispatched in server.

    Not really. The request is written immediately. It's just that the reply is delivered asynchronously.

    Cheers,

    Michi.