Anypoint Platform Custom Business Events

  • Written By WHISHWORKS
  • 23/03/2016

Business Events in the Anypoint Platform

All businesses demand that key events within the business processes should be tracked and made visible to the IT Operations or Business Heads.

MuleSoft’s Anypoint Platform provides an excellent way to do this. This feature, however, is the least used across many clients. Based on my experience, I believe that the clients are not aware of the business events because the developers fail to implement them in the Mule flows.

Custom Business Event can be designed and implemented to provide insights into runtime transactions. This enables administrators, support personnel and business users to identify points of failure and address them either reactively or proactively. One need not explore logs or back end systems to understand the status of the transactions.

Anypoint Platform Custom Business Events

Use Case 1

In the case of a credit card processing service, a Mule service interacts with an external payment gateway. One of the KPI’s in this case is to track failed card processing. With the help of a business event, matters such as failed transactions, reasons for failure, transaction amount etc. can be tracked and reported through the Anypoint’s On Premise or iPaaS Management Center. This facilitates businesses to perform a root cause analysis (RCA) and take preventive steps accordingly.

Use Case 2

Business heads are highly interested in data that affects day-to-day operations. Business events can be used to accelerate this process. They generate the tracking data so that an external reporting tool can analyze these events and report interactive charts for decision making.

Apart from the above, business events can also be used to track the Integration Core’s (Mule Server) performance indicators. This will help monitor seasonal changes and evaluate server capacity.

On-Premise & iPaaS

Anypoint Platform supports defining the same set of business events whether it is On Premise or iPaaS. These events can be designed, developed and monitored seamlessly across On premise and iPaaS solutions.

How to Use Custom Business Events

The following snippet shows a sample to track a payment status in the mule flow:

<tracking:custom-event event-name=”Payment Status” doc:name=”Payment Custom Business


<tracking:meta-data key=”PaymentStatus” value=”#[payload:payment_staus]”/></tracking:custom-event>

‘All’ or ‘None’ events

The property (see below) marks all events in the flow to be flagged as “on” or “off”. By using this property, default events provided by Anypoint Platform can be tracked:

<flow name=”flow” tracking:enable-default-events=”true|false”>


This is an example provided in the Anypoint Platform Documentation which elaborates on using Custom Business Events. For SPX, various use cases can be fulfilled by using this design approach.

Business Events on the CloudHub Console – Insights

Querying Business Events (Failed Transactions)

Anypoint Platform Custom Business Events, Querying Business Events

Sample Business Events Snippet

<tracking:custom-event event-name=”Processed Orders ” doc:name=”Processed Orders”>

<tracking:meta-data key=”Order Id” value=”#[payload[0].ID]”/>

<tracking:meta-data key=”Order Status” value=”#[[payload[0].order_status]]”/>

<tracking:meta-data key=”Charge Amount” value=”#[[payload[0].price]]”/>

<tracking:meta-data key=”Charge Amount” value=”#[[payload[0].operator]]”/></tracking:custom-event>


If you would like to find out more about how you can get the most out of your MuleSoft infrastructure, do give us a call at +44 (0)203 475 7980 or email us at

Other useful links:

How to Integrate Mule ESB with Microsoft Office-365 SharePoint

31 API Recipes with MuleSoft Anypoint Platform

MuleSoft solutions

Latest Insights

Salesforce health cloud - healthcare

Healthcare in the Cloud

Salesforce Health Cloud is designed to improve patient satisfaction, deliver high-quality patient care, and deliver positive outcomes.

Cloud API integration strategy

Cloud API integration strategy – an introduction

It is simple, with the growing market of SaaS applications and cloud computing, point-to-point integrations with custom code are no longer good enough to provide seamless connectivity between these applications. […]

Data visualisation

Data Visualisation 101

Data visualisation is a careful and thoughtful process of combining both data and visuals to convey the right message.