[Twisted-Python] producer / consumer question
markus at bluegap.ch
Wed Jul 4 12:13:05 EDT 2007
I have yet another question... a producer has to learn about it's
consumer somehow, otherwise it would not know where to write it's data to.
But the proposed interface is exactly vice versa: the IConsumer
interface has a registerProducer() method. Now, that would be fine, if
that did all the setup between a producer and a consumer. But AFACIS in
the twisted code, registerProducer() does not link itself with the
producer. Instead, the producers I've inspected (i.e. FileSender)
require an explicit initialization with a given consumer.
Why is that? What's the best way to associate a producer with a
consumer? Is something like the following okay:
def associateProducerConsumer(prod, cons):
prod.consumer = cons
More information about the Twisted-Python