Split Transactions on JSON Payload
You can access JSON payload for transaction identification purposes using the method where the Servlet unmarshalls the payload.
For example, the following JSON payload posts an order car creditcard http://acmeonline.com/store
order :{
type:creditcard,
id:123,
name:Car,
price:23
}}
The following code snippet shows the doPost
public void doPost(HttpServletRequest req, HttpServletResponse resp) {
//create JSONObject from servlet input stream
String orderType = jsonObject.get("type");
//read the item for the order
processOrder(orderType,item)
...
}
After the application unmarshalls the posted JSON payload to the JSON object, thetypekey is available to identify the type of the order. In this case, this key uniquely identifies the business transaction.
To use the JSON payload for transaction identification you must set the enable-json-bci-rules true
- On the Rule Configuration tab, checkSplit transactions using XML/JSON Payload or a Java method invocation.
- For the JSON object key, enter the name of the JSON object. For example,
type
.
The agent automatically intercepts the JSONObject. get("$JSON_Object_Key" doGet()