[Twisted-Python] Implementing an event manager in twisted
andrewfr_ice at yahoo.com
Fri Apr 13 13:35:49 EDT 2007
>Whew. :) I certainly don't plan to re-implement
>Twisted, since it already exists and it's ace; I want
>something at a higher level. My aim here is to make
>my existing application(s) even more modular so that
>functionality can be added and extended in a simple,
>common way. This principle has already provided
>excellent benefits in the past.
A good book on Event management is David Luckham's
"The Power of Events: An Introduction to Complex Event
Processing in Distributed Enterprise Systems."
I think the higher level stuff revolves around the
event pattern language (also known as the trigger
language)- how one defines an event and the mechanisms
for detecting events.
I am developing a WS-BPEL processor. Not many people
know about WS-BPEL. WS-BPEL is a language that has
event handlers that are based on time and web service
calls. To correctly implement the specification, I
also have to deal with triggering activities based on
patterns in a message or attributes of the SOAP
My experiences so far....
For time based stuff, Twisted is pretty strong (in
opposition - Stackless is weak). I use TaskLoopCall
help implement time and alarm triggered stuff.
For web services, I have been writing classes that
represent end-point-references based on the WSA
standard. For instance, a tasklet in my WS-BPEL
processor tells (or subscribes to) my "event manager"
that it is interested in a particular EPR (say a SOAP
message with a "buy" operation). In turn, a scheduler
suspends the tasklet. When my Twisted based Request
Handler receives a http request, as a part of the
response, the handler creates an EPR representing the
client end and sends it to the event manager. If the
"event manager" can match the incoming EPR, it will
ask the scheduler to wake up the associated tasklet.
So far, this works fairly well. For 80% of stuff,
Twisted and Stackless work really well together. My
EPR classes are still pretty rough. However in a month
or two, they should be in better shape. I am not sure
if anyone is really interested but I would be more
than happy to put it out there.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Twisted-Python