[Twisted-Python] Re: Producers / Consumers and more examples tutorials?

Michael King mking at humana.com
Tue Mar 13 09:26:03 EDT 2007

Jean-Paul Calderone <exarkun <at> divmod.com> writes:

> Just name a specific example you'd like to see and I'll try to write
> something up.  I don't want to pick something, write it up, and then
> discover that it doesn't cover what you wanted to learn. :)
> Jean-Paul


I never saw anyone ask for a specific example, and now I actually have one:

I am building a simple chat-like server, but instead of clients producing the
data sent over the channel, I am tailing a log file, turning it into an xml
node, and spitting it out to all connected clients.   At least, that's what
I'm trying to do.

My guess is that I would have the Consumer sub-class that I'd make use the
write() method to call the server's broadcast method.  Not a complaint, but
there's very little documentation on how things glue together, and the
fileserver example doesn't help.

So, I guess the example I'm looking for is something that:

* Has a producer that reads from a file, checking for changes periodically (I
think I have this done, I'll paste a link to the code at the end of this post)
* Has a consumer that then takes the data from the producer, and then
broadcasts it out to all clients on a simple server.

I don't need to see how to implement the server, that part I think I've
got down. :)

Producer source:  http://pastie.caboo.se/46607

I know it's not complete, but I think it's a start from what I understand about



More information about the Twisted-Python mailing list