webMethods Event Routing 10.3 | Understanding Event Routing | Event Types
 
Event Types
 
Event Structure
Heartbeats
Event Type Governance
Event Type Store
An event type is a schema definition that describes how events in an event stream are structured. Event types are first-class objects that are declared at a high level in the environment and can be processed by webMethods and non-webMethods products.
Events in the same stream always have the same payload structure. The schema defines which data fields are present in each event, the data type of each field, and the order in which the fields appear. Each event stream has exactly one event type associated with it. One event type can be used as the schema for more than one event stream. All event publishers on a given stream must ensure that their published events comply with the stream's schema, and all subscribers must be aware of the schema that describes the events received. In this respect, the schema represents a contract between publishers and consumers of events of a specific type.
Event types are implemented as schemas that conform to the W3C XML Schema (XSD) specification. Within the Event Type Editor, they are displayed as a hierarchy of nodes representing the content of the event. The nodes can be field nodes, composite nodes, or references to structures in other schemas. Field nodes are leaves within the node hierarchy enabling users to specify typed text strings in the XML event. Composite nodes are containers for field nodes, composite nodes, and reference nodes. At the underlying XSD level:
*The root node is invisible and is represented as a top-level element declaration with the substitutionGroup=”eda:Payload” attribute
*Composite nodes correspond to element declarations with a complex content model
*Field nodes are element declarations with a simple type
*References refer to top-level element or type definitions in other component schemas.
You can specify a cardinality for all visible nodes, whereas the hidden root node has a fixed cardinality of 1, denoting that a valid XML document has exactly one root element.
The XSD, as generated by the Event Type Editor, is only a subset of the full XML Schema specification. However, you can use an almost arbitrary XSD as event schema, as long as it does not contain the following:
*Substitution group
*Multiple child elements with the same name
*Filterable property for an element with cardinality bigger than 1.
In order to use a custom XSD as event schema, you must do the following:
*Add the following import statement:
<xsd:import namespace=”http://namespaces.softwareag.com/EDA/Event”
schemaLocation=”Event/Envelope.xsd”/>
Note: Depending on the location of the event type schema within the Event Types directory, the schemaLocation attribute may contain additional leading ../ steps for moving up in the directory hierarchy.
*Add the substitutionGroup=”eda:Payload” attribute to the declaration of the element to be the root of the event XML.
Here is a section of a sample event type schema:
<xsd:complexType name="PartInventoryLowType">
<xsd:annotation>
<xsd:documentation>Report inventory low for a part</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Part">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ItemID" type="xsd:string" minOccurs="1"/>
<xsd:element name="ItemName" type="xsd:string" minOccurs="0"/>
<xsd:element name="Model" type="xsd:string" minOccurs="0" />
<xsd:element name="Color" type="xsd:string" minOccurs="0" />
<xsd:element name="Shape" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="InventoryLevel" type="xsd:integer"/>
<xsd:element name="DesiredInventoryLevel" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
Here is a sample event instance:
<PartInventoryLow>
<Part>
<ItemID>ABC123</ItemID>
<ItemName>Widget </ItemName>
<Model>XYZ</Model>
<Color>Silver</Color>
<Shape>Oval</Shape>
</Part>
<InventoryLevel>58</InventoryLevel>
<DesiredInventoryLevel>1000<DesiredInventoryLevel>
</PartInventoryLow>

Copyright © 2010-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.