...
There are two ways to apply mediation extensions to messages. They are as follows:
- Global Extensions : Apply to all APIs
- Per-API Extensions : Apply only to an intended API
...
Given below is the naming pattern of the sequence to follow when creating a global extension sequence.
...
Given below is the naming pattern to follow when creating of a per-API extension sequence.
...
Code Block | ||
---|---|---|
| ||
<sequence xmlns="http://ws.apache.org/ns/synapse" name="admin--TwitterSearch:v1.0.0--In"> <log level="custom"> <property name="TRACE" value="API Mediation Extension"/> </log> </sequence> |
Info |
---|
NOTE: The tenant username must be given as |
To test the code in super-tenant mode, copy it to an 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.
...
Alternatively to the above approach, you can also attach extension sequences to an API using the API Publisher Web interface , at the time the API is created. Log in to the API Publisher (https://localhost:9443/publisher) and click Add from the left panel. In the Add New API page that opens, navigate down to the Sequences section. There, you can select In/Out sequences for the API from the drop-down lists. For example,
...
When an API is published, a file with its synapse configuration gets is created on the API Gateway. This synapse configuration has a set of handlers as shown in the following example:
...
For more information on Handlers, see Architecture Components.