Blogs

Anypoint Platform Custom Business Events

Written by Coforge-Salesforce BU | Mar 21, 2016 6:30:00 PM

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.


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

Event">

<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">

Example

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)


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>

Reference:

https://docs.mulesoft.com/mule-management-console/v/3.6/business-events-use-cases

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 Salesforce@coforge.com

Other useful links:

How to Integrate Mule ESB with Microsoft Office-365 SharePoint

31 API Recipes with MuleSoft Anypoint Platform

MuleSoft solutions