Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RPC queue result processing order

    Hi,

    A queue sends requests in 1 HTTP request to server and server also sends the responses in 1 HTTP request to client.
    Are the RPCCallback executes also guaranteed to be executed in the order they were set in queue?
    And seeing as JavaScript only has 1 thread, does that mean that whenever the last RPCCallback in the queue was executed, it is guaranteed that all others are finished?


    For instance here:
    Code:
    RPCManager.startQueue();
    doA(withRPCCallbackA);
    doB(withRPCCallbackB);
    doC(withRPCCallbackC);
    RPCManager.sendQueue();
    doA doB doC are some methods which include an async call to the server with RPCCallback objects.


    Is the following true?
    1) The execute method in withRPCCallbackB can see objects from the result of call A, not yet from call C.

    2) The execute method in withRPCCallbackC can see objects from A, B and C.

    3) When the execute method in withRPCCallbackC ends, all results are processed.


    Thanks for the input.

    SmartGWT EE 2.3 official

    #2
    Yes, all correct.

    Comment


      #3
      Aw, queuing is not supported when using different DataSources.

      How does it technically work then if you have a PersonDS and an AddressDS and you want to call a server operation "verifyPersonsAddress" on AddressDS without having stored the Person and Address objects in the backend? In this operation, you need the data from Person and Address.

      Comment


        #4
        Actually, queuing is supported across multiple DataSources and even with non-DataSource DMIs (called RPC DMIs). See this sample of multi-dataSource queuing and note the use of transaction chaining to coordinate across multiple requests within the same queue.

        Comment


          #5
          Oh, thanks. I'll look into that example then, as I got this warning when I first tried it with a simple fetch on 4 different DataSources:
          RPCRequest specified (or defaulted to) URL: which is different than the URL for which the RPCManager is currently queuing: - sending this request to server and continuing to queue

          Comment


            #6
            Yeah, it's not possible for the browser to send a single HTTP request to two URLs. This why you should use a single URL for all data requests, allowing them to be arbitrarily combined via queuing.

            Comment

            Working...
            X