Class EventFramework::EventFramework
In: event.rb
Parent: Object
WorkerThread EventDispatcher EventProcessor EventHandler NullEventHandler ChainEventHandler PrintEventHandler EventFramework EventGenerator Event EventFramework Module: EventFramework

The EventFramework is a facade designed to simplify the use of the various components of this event framework. It automatically creates the event queue, EventProcessor, and EventDispatcher. Users should:

  1. Optionally register EventGenerators that will be polled by the framework at regular intervals for Events.
  2. Optionally register an error handler used when an error occurs during the processing of an Event.
  3. Start the event framework and all of its associated components by invoking the start method.
  4. Optionally dispatch Events explicitly using the dispatch_event method.
  5. Stop the event framework and all of its associated components when finished with the framework.
Methods
<<    add_event_generator    dispatch_event    error_handler=    new    start    stop   
Public Class methods
new(wait_interval=1)

Creates an instance of the EventFramework with the specified parameters:

wait_interval
An optional parameter specifying the interval (in seconds) that is used to poll EventGenerators. The default value is 1 second.
Public Instance methods
error_handler=(handler)

Sets an error handler (an EventHandler) to be used when an error occurs processing an Event. See EventProcessor documentation for more information on error handling.

dispatch_event(event)

Explicitly dispath an Event into the event framework for processing. This method can be used in conjunction with the implicit dispatching of Events via EventGenerators.

event
The Event to dispatch on the event queue.
add_event_generator(generator)

Registers an EventGenerator. EventGenerators are then polled at regular intervals for Events that are placed on the event queue. EventGenerators should not be added after the framework has been started.

generator
The EventGenerator to register.
This method is also aliased as <<
<<(generator)

Alias for add_event_generator

start()

Starts the event framework.

stop()

Stops the event framework.