You are not logged in Log in Join
You are here: Home » Members » Tres Seaver's Zope.org Site » Various Projects » Multiplexing calls in ZEO RPC » wiki » SynchronousCall » wikipage_view

Log in
Name

Password

 
 
FrontPage » ScenarioList »

SynchronousCall

Multiplexed Zope RPC

Scenario: Synchronous Call

Assumptions

  • Calling thread wants to send a message to the server and await its reply, synchronously.
  • The server may send asynchronous messages directed to the calling thread; these messages must be handled by that thread.

Procedure

  1. Client thread invokes the ZRPC object, passing the method name as the first of a set of arbitrary arguments.
  2. ZRPC finds/creates a ThreadMessageHandler? corresponding to the current thread ID, and delegates the invocation to it.
  3. The handler marshals its threadID and the passed arguments into a message, and calls back up to the ZRPC object to put the message on the wire.
  4. Handler drops into "consumer mode" on its message queue, processing "out-of-band" messages while waiting for a response or exception message.
  5. Meanwhile, the asyncore loop is pushing inbound messages to the ZRPC object, which unpacks the threadID from the message and dispatches it to the corresponding handler, in "producer" mode.
  6. The "blocked-in-synchronous call" handler finally receives a reply:
    • if it is a normal return, the handler unmarshals the value, if any, and returns it.
    • otherwise, the handler unmarshals the exception and raises it.