Tracking a Custom Business Event
home
Shows how to track data using the custom business event component.
Example
Order data in JSON format is sent through an HTTP endpoint to a Ruby transformer. The custom code embedded with this component is used to calculate the discount that is offered for a certain product type. The Custom Business event keeps track of the item name, number of units and price per unit for the order data.
Set Up and Run the Example
Install this example into your Anypoint Studio workspace from Anypoint Exchange.
Export the project from your Studio workspace to a zip file using File > Export > Mule > Anypoint Studio Project to Mule Deployable Archive.
Sign in to Anypoint Platform > Runtime Manager.
Click Deploy Application and choose the deployable zip file.
In the Advanced Settings tab enable Metadata and Replay and then Apply changes.
Click Start to deploy your application in Runtime Manager.
Use Postman to make a POST request using JSON to http://(yourdomain).cloudhub.io:
{ "email": "aaa@abc.sk", "item name": "shoes", "item units": 2, "item price per unit": 10, "membership": "free" }
The response body should contain price per unit with the applied discount (-15% for shoes):
Go to your Runtime Manager account and click the Insight tab in the left panel to see that your custom business event was logged.