Getting Started
ESF Files
In developing an LWES application there a couple of things to consider:
- What sort of events do I want in the system?
- Do I want data consistency between the emitters and listeners?
Question 1 is really part of application design, and question 2 is either yes or no. Both of these are implemented via the creation of an Event Specification Format (ESF) file. An ESF file provides a list of events which contain some number of named attributes which are one of a basic set of types. The specifics of the format are described separately, but for the examples below we will select an event which contains 4 fields, a string, a 64 bit integer, a boolean and an ip address. We will call this event UserLogin and place its description in a file called user.esf.
# the MetaEventInfo is a special single level of inheritance of events. Any # fields in this Event are allowed in all other events. Certain systems # will set these fields, so the SenderIP, SenderPort, and ReceiptTime are # set by all journallers and listeners, while the encoding is set by all # emitters. MetaEventInfo { ip_addr SenderIP; # IP address of Sender uint16 SenderPort; # IP port of Sender int64 ReceiptTime; # time this event was received, in # milliseconds since epoch int16 enc; # encoding of strings in the event uint16 SiteID; # id of site sending the event } UserLogin { string username; # username of user uint64 password; # unique hash of the users password ip_addr clientIP; # client ip the user attempted to connect from }
The above text would be put into a file. If this file is given to a particular component (either an emitter or listener, journallers do not use this file), then that particular component will check all fields of the event as they are set, and any attempt to set a field wrong will result in an exception or error. If this file is not given then events are not checked against this. This may be useful in systems where you want the events to change without restarting emitters or listeners.
Next we will describe the use of this by developing equivalent emitters and listeners using the three different language bindings.