...
The <DIRECTION>
can be either In
or Out
. When the direction of the sequence is In
, the extension is triggered on the in-flow (request path). When the direction of the sequence is Out
, the extension is triggered on the out-flow (response path). Following Shown below is an example synapse configuration of a global extension sequence.
...
To test the code, copy it to an XML file (e.g., global_ext.xml) and save the file in the <APIM_HOME>/repository/deployment/server/synapse-configs/default/sequences
directory. The above sequence prints a log message on the console on every API invocation.
...
<API_NAME>:v<VERSION>--<DIRECTION>
Following Shown below is an example synapse configuration of a per-API extension sequence. It is created for an API named admin--TwitterSearch with version 1.0.0.
...
To test the code in super-tenant mode, copy it to an xml XML file (e.g., twittersearch_ext.xml) and save the file in the <APIM_HOME>/repository/deployment/server/synapse-configs/default/sequences
directory if you are using a standalone server. In multi-tenant mode, copy the file to the tenant's synapse sequence folder. For example, if tenant id is 1 then copy it to <API_Gateway>/repository/tenants/1/synapse-configs/default/sequences
folder.
The above sequence prints a log message on the console whenever the TwitterSearch API is invoked.
...
The handler by the name APIManagerExtensionHandler
triggers both global as well as per-API extension sequences. It reads the sequence names and determine determines what APIs need to must be invoked. By default, the extension handler is listed at last in the handler chain, and therefore is executed last. You can configure the API Gateway to execute extension handlers first. To do that, open <APIM_HOME>/repository/conf/api-manager.xml
file, uncomment the <ExtensionHandlerPosition>
element section and provide the value top
as follows:
...