LAZY AND STATELESS EVENTS
Event-based processing is employed in conjunction with lazy and stateless events. Addition of any handlers is deferred until a user-specified handler is identified. Furthermore, event handlers can be composed at this time including the same properties as underlying events. More specifically, handlers specified on composite events can be composed and propagated up to a one or more related source events. As a result, handlers are not accumulated on composite events thereby making them stateless while allowing equivalent functionality upon invocation of the composed top-level handler.
1 . An event-based processing system, comprising:
an interface component that identifies event-based constructs including first class events; and
a handler composition component that defers addition of any event handlers until a user-specified handler is identified upon which the handler is lazily added to an event.
2 . The system of claim 1 , further comprising a dependency component that determines dependency relationships between source and composite events.
3 . The system of claim 2 , further comprising a handler generation component that generates a computed handler for addition to a related source event as a function of a specified event and one or more events from which the specified event depends.
4 . The system of claim 3 , functionality of the handler composition and generation components is captured by a combinator component that produces a composite event as a function of one or more source and/or composite events and predicates or selector functions.
5 . The system of claim 4 , the combinator component employs closures with deferred event handler additions.
6 . The system of claim 4 , the combinator component employs an explicit closure class design pattern with deferred event handler additions.
7 . The system of claim 3 , the handler generation component maintains multiple handler categories including at least success and failure values or continuations.
8 . The system of claim 3 , the handler composition component maintains removal functions associated with the handler that enables an added handler to be removed.
9 . A method of event execution, comprising:
composing first class events; and
lazily adding handlers to source events as a function of event dependencies.
10 . The method of claim 9 , further comprising generating a computed handler for handlers specified on composite events and propagating the computed hander to one or more related source events such that the composite events are stateless.
11 . The method of claim 10 , comprising propagating the handlers lazily by way of one or more combinators that define composite events.
12 . The method of claim 11 , employing closures or an explicit closure design pattern to enable lazy adding.
13 . The method of claim 10 , further comprising invoking the computed handler for a composite event when the event is raised.
14 . The method of claim 10 , further comprising maintaining a removal function associated with the computed handler to facilitate removal of the handler.
15 . The method of claim 14 , further comprising executing the removal function to remove a handler.
16 . The method of claim 10 , further comprising maintaining multiple handler categories corresponding to at least success and failure for the computed handler.
17 . The method of claim 9 , comprising implementing the first class events using continuation monads.
18 . An event processing method, comprising:
constructing a composite event; and
deferring addition of any event handlers until a handler is specified by a user.
19 . The method of claim 18 , further comprising:
acquiring a handler for the composite event,
computing a handler as a function of the acquired handler; and
adding the computed handler to a source event related to the composite event.
20 . The method of claim 19 , further comprising invoking the computed hander when an event is raised.