I just want to make sure it's clear that the ordering behavior you have
observed here is not guaranteed. Requests made before a connection is
established are not necessarily reversed, the connection state internally
may change after a connection is established, and requests on the same
client may even get sent to different servers, making their order
completely independent.

On Mon, Aug 10, 2020 at 10:04 AM vijeth AG <[email protected]> wrote:

> So on the 1st call, while connection is in progress, any subsequent client
> calls made are stacked up. once the connection is established the call
> stack is resolved.
>
> Just to validate: I made 3 calls after a 1st init call gets resolved as in
> code below.  Prints in the order of 1,2,3
>
> Thanks for your reply.
>
> client.sayHello({name: "init"}, function(err, response) {
> console.log('init complete', response.message);
>
> client.sayHello({name: "1"}, function(err, response) {
> console.log('1 Sayhello:', response.message);
> });
> client.sayHello({name: "2"}, function(err, response) {
> console.log('2 Sayhello:', response.message);
> });
> client.sayHello({name: "3"}, function(err, response) {
> console.log('3 Sayhello:', response.message);
> });
> });
>
> On Mon, Aug 10, 2020 at 9:47 PM Michael Lumish <[email protected]> wrote:
>
>> Those requests all happen independently. We don't make any guarantees
>> about their order, so the library internals are free to reorder them before
>> sending them out. In this case, the first requests you make after you
>> construct the client object cause it to start connecting, so those requests
>> will be queued before sending them out, making them more likely to be
>> reordered.
>>
>> On Mon, Aug 10, 2020 at 8:51 AM vijeth AG <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have started exploring gRPC with Node.js, by basic hello world level
>>> client-server js.
>>>
>>> Code gist snippets and outputs below.
>>>
>>> I have noticed a strange thing If I instantiate a *client* and call
>>> remote function 3/4 times simultaneously, the responses of the calls are
>>> printed in reverse order - Last called rpc prints out first.
>>>
>>> Hello.proto
>>> https://gist.github.com/vijeth-ag/706bb09d9b5e21b29a780ebb355d56ed
>>>
>>> server.js
>>> https://gist.github.com/vijeth-ag/db97b6cacf7e07d3709d4edb2ecb6c29
>>>
>>> client.js
>>> https://gist.github.com/vijeth-ag/0affe7b04d10b0e0d1cd4771abc16b99
>>>
>>> Actual output: on running client.js
>>>
>>> 3  Sayhello: Hello 3
>>> 2  Sayhello: Hello 2
>>> 1  Sayhello: Hello 1
>>>
>>> I was expecting in the order 1,2,3
>>>
>>> Also debugged server.js - the first value received in sayHelloFunction
>>> is 3.
>>>
>>> I if I add delay in between call works in the order 1,2,3 as expected.
>>>
>>> Please Im curious what am I missing.
>>> Thanks in advance
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "grpc.io" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/grpc-io/d3353aef-9770-45bb-ae75-058e5905f414n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/grpc-io/d3353aef-9770-45bb-ae75-058e5905f414n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>
> --
> Regards
> vijeth
> +91-9620962446
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAPK2-4cZe3F5Q5ctFq%3DRFdAgw4FnvhommOBEQfj8gWci8OAJEA%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to