def start(self): httpMonitor = HTTPResourceMonitor(30.0) httpMonitor.activate() newProfileFeedReader = FeedReaderComponent() newProfileFeedReader.activate() newProfileHandler = NewProfileHandler(base_dir, self.atompub) newProfileHandler.link((newProfileFeedReader, 'outbox'), (newProfileHandler, 'inbox')) newProfileHandler.activate() from Kamaelia.Util.OneShot import OneShot shot = OneShot() httpMonitor.link((shot, 'outbox'), (httpMonitor, 'monitor')) shot.send(('http://localhost:8080/profile/new/feed', newProfileFeedReader)) profileFeedReader = FeedReaderComponent() profileFeedReader.activate() profileHandler = ProfileHandler(base_dir, self.atompub) profileFeedReader.link((profileFeedReader, 'outbox'), (profileHandler, 'inbox')) profileHandler.activate() from Kamaelia.Util.OneShot import OneShot shot = OneShot() httpMonitor.link((shot, 'outbox'), (httpMonitor, 'monitor')) shot.send(('http://localhost:8080/profile/feed', profileFeedReader)) self.running = True
for url, targetOutbox in self.urls: self.send(url, targetOutbox) if not self.anyReady(): self.pause() yield 1 if __name__ == '__main__': from Kamaelia.Util.Console import ConsoleEchoer from Kamaelia.Util.OneShot import OneShot from atomhandler import FeedReaderComponent shot = OneShot() monitor = HTTPResourceMonitor() monitor.link((shot, 'outbox'), (monitor, 'monitor')) feedreader = FeedReaderComponent() printer = ConsoleEchoer() feedreader.link((feedreader, 'outbox'), (printer, 'inbox')) shot.send(('http://localhost:8080/profile/feed', feedreader)) printer.activate() feedreader.activate() #shot.activate() monitor.run()