This document discusses using custom business events in Mule to track business data for auditing and reporting. It describes adding metadata and key performance indicators (KPIs) using the Custom Business Event component. Business events can be viewed on the management console and used for root cause analysis or identifying bottlenecks. Custom events can be defined and monitored seamlessly across on-premise and cloud environments. The document provides instructions for configuring custom events in a Mule flow by defining an event name and KPIs to track transactions.
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Custom Business Events in Mulesoft
1. Custom Events
In thisblog, we will demonstrate howtouse custom businesseventsinmule inordertrack the business
data for audit purpose or any other kind of reporting purpose.
Use the Custom Business Event component (tracking:custom-eventelement in the XML view) to add
metadata and Key Performance Indicators (KPIs) to your flow.
The Business Events tab on the management console gives you visibility into business transactions and
eventsonyourMule servers,allowingyoutotrack and analyze the flow anddispositionof messages.For
example,you can use the data to do root cause analysis on a failure within a business transaction or
identify message processing bottlenecks.
Anypoint Platform supports defining the same set of business eventswhether it is On Premise or iPaaS.
These events can be designed, developed and monitored seamlessly across on premise and iPaaS
solutions.
‘All’or ‘None’ events
The property(see below) marksall eventsinthe flow tobe flaggedas“on” or “off”.By using this
property,defaulteventsprovidedby AnypointPlatform canbe tracked:
<flowname=”custom-business-eventFlow”tracking:enable-default-events=”true|false”>
Configure Custom Business Events
Let’ssee howto configure custombusinesseventsinourmule flow.
Create projectinAnyPointstudioandconfigure the listener.
Drag and drop custombusinesseventfrommule paletteandconfigure the EventName andKPIsas
shownbelow
2. Here the KPI iseventId,sothatwe can track the transactionwithoutanyhurdles.
Let’sdeploy the same application tothe CloudHub.
To see KPI’syoumustenable Insightsforyour application duringdeployment,like below:
Once deploymentiscompletedSuccessfully,let’sTestthe same.
Validate Custom Business Events
Openthe Postman,andtriggerthe requestforCustomBusinessEventasbelow:
3. Goto the CloudHubandclickon the insightTab.
Trace the transactionand youcan checkyour applicationKPI’sthatyoudefinedinyourmule
application.
Thisis the simplestwaytoaddthe CustomBusinessEventID.Similarway,we canaddas many KPIsyou
need.
For yourKPIs,use namesthat are easyto searchfor inthe AnypointRuntime Managerinterface,and
use a representativevalue,whichcanbe anyMule expression:
Name Expression/Value
employee-id #[payload['ID']]
employee-email #[payload['Email']]
employee-git-id #[payload['GITHUB_ID']]