Transaction-ID Policy
Overview
This policy API Manager Policies/Create Transaction-ID
can be used to generate a transaction ID across multiple API requests that belong to the same logical transaction. The policy extracts the HTTP header: X-TransactionID
in the first step and if it is not set, a new transaction ID is generated. This is finally added as a new HTTP header.
In order for a transaction to be recognized across multiple requests, the generated transaction ID must of course be sent again in the same header in subsequent requests.
Setup
- Import the Policy-Fragment
Import the policy fragment into your group policy configuration. It has version 7.7.0 and with that it can be imported in any later release. You will get the following new policy: API Manager Policies/Create Transaction-ID
- Register as Global-Request Policy
Register this policy as a global request policy for the API Manager and enable it in the API Manager UI.
Alternatively, you can of course include this policy as a policy callback in an existing policy or include it in your policies exposed directly by the API-Gateway.
- Export Transaction-ID
As a final step, export the generated transaction ID to the event logs. This allows you to integrate them into 3rd party systems.
The Transaction-ID will become part of the Event-File:
{
"type": "transaction",
"time": 1613426684268,
"path": "/api/emr/diagnostic",
"protocol": "https",
"protocolSrc": "8065",
"duration": 69,
"status": "success",
"serviceContexts": [
{
...
}
],
"customMsgAtts": {
"transactionId": "w3btDF7a+p+6mZCA0Q86WRghf54="
},
"correlationId": "fcef2a6002c28f824afb698c",
"legs": [
{
...
}
]
}