Question

Trying to build a twisted application that will receive messages on multiple ports. The ports should generate Alert objects which amongst other things have a tag property and a trigger property. The app should then check to see if there is already an AlertJob with that tag. If there is it should just enqueue the Alert to that AlertJob and if not it should first create the new AlertJob. The AlertJob's ... job is to periodically check the trigger and if trigger conditions are met, to notify the main app again. And here is my question:

How can I hook a custom class (AlertJob) into twisted's reactor so that it continuously verify's if trigger conditions are met for any of the running jobs ?

Was it helpful?

Solution

If your application calls for a time-based event source, then twisted.internet.reactor.callLater or twisted.internet.task.LoopingCall is probably what you're looking for. These are both covered in the scheduling howto.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top