Custom Business Event in Mule 4
You can use Custom Business Event
(tracking:custom-event) components to add metadata and Key Performance
Indicators (KPIs) to your flow.The key/value pairs can vary according to your
business needs.
flow of Custom Business Event :
flow of Custom Business Event :
Custom business event
configuration:
Method: POST
Input :
{
"id"
: 1
}
Output:
{
"id"
: 1
}
XML project
code:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="7939b75c-5ffb-4891-bb0a-a0a7d1a45eba" >
<http:listener-connection host="0.0.0.0" port="8085" />
</http:listener-config>
<flow name="test_custom_bus_eventFlow" doc:id="f2aaa2e3-08e9-4ffd-92ef-acba8c2ed3f1" >
<http:listener doc:name="Listener" doc:id="e75801b5-d442-4836-8eba-0323216cb569" config-ref="HTTP_Listener_config" path="/custom"/>
<tracking:custom-event doc:name="Custom Business Event" doc:id="0c2a5981-534c-48e2-bd42-f5ad02265744" event-name="Event">
<tracking:meta-data key="id" value="#[payload.id]" />
</tracking:custom-event>
</flow>
</mule>
No comments:
Post a Comment