Use the Event Emitter mediation primitive to emit business events from within a mediation flow, if an unusual event occurs.
The Event Emitter mediation primitive sends out business events, during a mediation flow. The events are generated in the form of Common Base Events (CBE) and are sent to a Common Event Infrastructure (CEI) server. For information on CEI resources and services refer to the runtime product documentation and runtime online help.
You can generate events that include all or part of the message being processed. Alternatively, you can generate events that do not include any part of the message being processed.
You can generate events that include all or part of the message being processed, by setting the Root property. The Root property is an XPath expression that specifies the section of the Service Message Object (SMO) that is included in the CBE application specific elements (extended data elements). The Root property can specifiy the complete SMO, a subtree or a leaf element.
If you do not set the Root property then you generate events that do not contain any part of the message being processed. You also generate events that do not include the message in another way. If you specify the Root property, but its value does not match any of the elements in the SMO when the message is mediated.
The Event Emitter mediation primitive has one input terminal and two output terminals. One output terminal is for successful output and one for failure output. The input terminal is wired to accept a message and the output terminals are wired to propagate a message. The successful output terminal propagates the original message. If an exception occurs during the processing of the input message, then the fail terminal propagates the original message, together with any exception information.
Extended Data Element | Description |
---|---|
ModuleName | The name of the module instance |
MediationName | The name of the Event Emitter instance |
Root | The Root property value |
Extended Data Element | Description |
---|---|
Message | Contains the section of the SMO specified by the Root property. This extended data element can contain other, nested, extended data elements corresponding to elements in the specified section of the SMO |
To fully utilize Event Emitter information, event consumers need to understand the structure of the CBE. The mechanism for modeling this data is described in more detail in the Detailed event contents section below.
The Event Emitter mediation primitive enhances your monitoring capability by allowing you to send business events from within a mediation flow component. You can then view the Event Emitter events using the CBE browser, on the application server, or other CBE consumer applications.
The recommended best practice is to use the Event Emitter mediation primitive to indicate an unusual event, such as notification of a failure within the flow or an unusual path executed in a flow. When you place event emitters within a flow you should consider the possible number of events that may be generated as well as the size of the message that will be stored within the event. Placing an event emitter within the normal flow execution path will generate many events compared to placing it within an unusual event or failure path. In addition, consider configuring the emitter to store only significant message data rather than the complete message to reduce the overall size of the event.
You can use the Event Emitter mediation primitive to record a failure in another mediation primitive, and then continue processing. To do this you wire the fail terminal of the previous mediation primitive to the input terminal of the Event Emitter mediation primitive; and wire the output terminal of the Event Emitter mediation primitive to the next step in the flow.
You can also use the Event Emitter mediation primitive, in combination with the Message Filter mediation primitive, to generate business events based on message content. To do this you wire one of the output terminals of the Message Filter mediation primitive to the input terminal of the Event Emitter mediation primitive; and wire the output terminal of the Event Emitter mediation primitive to the next step in the flow.
Property | Valid Values | Default |
---|---|---|
Label | String | Combination of module name, flow name and flow type. The flow type indicates whether the flow is a request or response |
Transaction mode | String: Existing, New or Default | Default |
Root | String: an XPath expression representing the root of the SMO that will be stored in the event |
Consider the following when using the Event Emitter mediation primitive:
The events emitted from the Event Emitter mediation primitive conform to the Common Base Event 1.0.1 structure. The Common Base Event specification is part of the IBM Autonomic Computing Toolkit. For more information about the specification, visit the IBM Autonomic Computing Web site at http://www.ibm.com/autonomic/.
The information below describes some of the contents of the event generated from the Event Emitter primitive.
<extendedDataElements name=”ModuleName” type=”string”> <values>CustomerMediation</values> </extendedDataElements>
<extendedDataElements name=”MediationName” type=”string”> <values>ServiceFailureEvent</values> </extendedDataElements>
<extendedDataElements name=”Root” type=”string”> <values>/body/operation1/input1/customerID</values> </extendedDataElements>
<extendedDataElements name=”Message” type=”string”> <values>ABCDE12345</values> </extendedDataElements>If the Root property evaluates to a sub-tree within the message, the Message extended data element will contain child extended data elements corresponding to the message tree structure. For example, the message defined by the XSD type definitions described below:
<xsd:complexType name=”MyBO”> <xsd:sequence> <xsd:element name=”value1” type=”xsd:string”/> <xsd:element name=”value2” type=”bons0:MySubBO”/> </xsd:sequence> </xsd:complexType> <xsd:complexType name=”MySubBO”> <xsd:sequence> <xsd:element name=”value1” type=”xsd:string”/> <xsd:element name=”value2” type=”xsd:int”/> </xsd:sequence> </xsd:complexType>would produce the following example Message extended data element:
<extendedDataElements name=”Message” type=”noValue”> <children name=”value1” type=”string”> <values>ABCDE</values> </children> <children name=”value2 type=”noValue”> <children name=”value1” type=”string”> <values>ZYXWV</values> </children> <children name=”value2” type=”int”> <values>12345</values> </children> </children> </extendedDataElements>