The Publish Event mediator constructs events and publishes them to different systems such as BAM and CEP.
The Publish Event mediator is a content-aware mediator.
Syntax
<publishEvent [eventSink="string"] [streamName="string"] [streamVersion="string"> <attributes> <meta> <attribute name="string" (value="literal" | expression="[XPath|json-eval(JSON Path)]") [type=string|integer|boolean|double|float|long]/>* </meta> <correlation> <attribute name="string" (value="literal" | expression="[XPath|json-eval(JSON Path)]") [type=string|integer|boolean|double|float|long]/>* </correlation> <payload> <attribute name="string" (value="literal" | expression="[XPath|json-eval(JSON Path)]") [type=string|integer|boolean|double|float|long]/>* </payload> <arbitrary> <attribute name="string" (value="literal" | expression="[XPath|json-eval(JSON Path)]") [type=string|integer|boolean|double|float|long]/>* </arbitrary> </attributes> </publishEvent>
UI Configuration
Parameters that can be configured for the Publish Event mediator are as follows.
Parameter Name | Description |
---|---|
Stream Name | The name of the stream to be used for sending data. |
Stream Version | The version of the stream to be used for sending data. |
EventSink | The name of the event sink to which the events should be published. |
You can add the following four types of attributes to a Publish Event mediator configuration.
Meta Attributes: The list of attributes which are included in the Meta section of the event.
Correlated Attributes: The list of attributes that are included in the Correlated section of the event.
Payload Attributes: The list of attributes that are included in the Payload section of the event.
Arbitrary Attributes: The list of attributes that are included in the Arbitrary section of the event.
The parameters that are available to configure an individual attribute are as follows.
Parameter Name | Description |
---|---|
Attribute Name | The name of the attribute. |
Attribute Value | This parameter specifies whether the value of the attribute should be a static value or an expression.
|
Value/Expression | The value of the attribute. You can enter a static value, or an expression to evaluate the value depending on the selection made in the Attribute Value parameter. |
Type | The data type of the attribute. |
Action | Click Delete in the relevant row to delete an attribute. |
Example
In this configuration, the Publish Event mediator uses four attributes to extract information from the ESB. This information is published in an event sink in WSO2 BAM named bam_event_sink
.
<publishEvent> <eventSink>bam_event_sink</eventSink> <streamName>stream_88</streamName> <streamVersion>1.1.2</streamVersion> <attributes> <meta> <attribute name="http_method" type="STRING" defaultValue="" expression="get-property('axis2', 'HTTP_METHOD')"/> <attribute name="destination" type="STRING" defaultValue="" expression="get-property('To')"/> </meta> <correlation> <attribute name="date" type="STRING" defaultValue="" expression="get-property('SYSTEM_DATE')"/> </correlation> <payload> <attribute xmlns:m0="http://services.samples" name="symbol" type="STRING" defaultValue="" expression="$body/m0:getQuote/m0:request/m0:symbol"/> </payload> </attributes> </publishEvent>