RuleCore Event Format
From RuleCore Support
The event format used by ruleCore is simple, yet powerful and flexible.
All events consists of only two parts; the header and the body. The event header is common for all events. For outbound reaction events, the header is automatically created and the contents of the body is filled in by executing the action defined for the rule. The action executes the user supplied XSLT transform which was defined when creating the action. The XSLT transform is executed in the context of the rule instance.
The general structure of any event is:
<EventType base:eventId="3690cbe0-d36c-11dc-95ff-0800200c9a66" base:eventTimestamp="2008-12-10T10:20:10.34544" base:eventClass="system|user" xmlns="http://www.rulecore.com/schema/2008/user" xmlns:base="http://www.rulecore.com/2008/base"> <base:EventHeader/> <base:EventBody/> </EventType>
The overall structure of any ruleCore event is specified by the ruleCore XML Schema and the RuleCoreEvent complex type, every event inherits a number of common properties from this schema.
The root element of all events denotes their type. For example an user event of type ERROR would have the root element <ERROR>.
Common Attributes
The root element must also have the following attributes:
- eventId - An UUID specifying the unique id of the event. By the nature of the UUID it is guaranteed that every event have an unique id. The UUID value for the eventId attribute can be created by the sending system or assigned by ruleCore. Multiple distributed systems can safely create event ids at the same time without any coordination. The eventId attribute belongs to the base namespace.
- eventTimestamp - The point in time when the activity of which this event is an notification of occured. The time must be formatted according to ISO 8601 international standard for time and date representation. The combined date and time format, for example
2008-02-04T16:47Z, is used by ruleCore. The eventId attribute belongs to the base namespace. - eventClass - Every event belongs to wither
systemoruserevent class. Events in the system class are pre-defined and events in the user class must be defined using the AddEventDef system event. The eventId attribute belongs to the base namespace.
Event Body
The event body contains the user generated payload of the event. The contents can be any valid XML fragment as chosen by the sending system. The payload should be located under the EventBody element. The body can later on be queried with XPath to let the contents of the event body control certain aspects of rule evaluation. The EventBody tag belongs to the base namespace.
For example, events can be selected into the event stream view of an rule instance based on the contents in the event body.
Event Header
The EventHeader contains event meta data.
The Credentials element contains the access token which is received when creating a subscription to the ruleCore service.
Note: This access token is only needed when using the ruleCore subscription service.
The access token can also be found on your ruleCore Service subscription web page. Events sent into the ruleCore service without a correct security access token are discarded. Also note that the type of the service you subscribe to can limit the maximum size of events and maximum number of events per month.
The event header also contains information about the event which caused this particular event to occur. The <CausedBy> element contains an event id of the event which caused the event to be created. If it is not possible to determine the event causality relation, the CausedBy element can be omitted.
The EventHeader element, and all its sub-elements, belong to the base namespace.
Example of a typical event header:
<base:EventHeader xmlns:base="http://www.rulecore.com/2008/base"> <base:SecurityInfo> <base:Credentials>12345678-1234-1204-1234-123456789abc</base:Credentials> </base:SecurityInfo> <base:CausedBy> <base:Event eventId="e75cc700-d36f-11dc-95ff-0800200c9a66" eventType="SOAP_CALL_put" index="1"/> <base:Event eventId="a88cc945-d36f-44dc-95ff-2423423c9a66" eventType="SOAP_CALL_get" index="2"/> </base:CausedBy> </base:EventHeader>