[Twisted-Python] Deferred Network requests

Simon Pickles sipickles at hotmail.com
Sat Mar 29 08:51:29 EDT 2008


I've been using twisted in a low-level way for some time and am now 
interested in the higher level aspects.

Particularly I hope to be able to make deferred requests across a 
network. I'd like to have a hub server, with many small apps (modules) 
which are all clients of the hub server.

I'd like the modules to be able to request information from each other, 
via the hub, in a deferred way, so the callback will be triggered when 
the requested information arrives.

So I need a chain like this:

ModuleA.RequestName(id).addCallback(modACallback) -> Hub
Hub.RequestName(id).addCallback(hubCallback)-> ModuleB
ModuleB.SendNameToHub() -> Hub
Hub.hubCallback triggered: SendNameToModA() -> ModuleA
ModuleA.modACallback triggered - request is complete.

Perhaps one issue is that I have a client->server->client sequence.

Although it looks slow, I am designing my system to be as concurrent as 
possible. Also, the hub can make decisions about sharing requests with 
several modules on a round-robin, or sending requests (and events, 
particularly) to more than one module.

I know I can do this through TCP or similar, but hoped someone might 
suggest which elements of twisted (a very large framework) I should look 
at more closely.

Many thanks!


Linux user #458601 - http://counter.li.org.

More information about the Twisted-Python mailing list