Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
titleAPI Extension Sequence Example
<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>

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. If you are in a distributed client setupIn 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 handler by the name APIManagerExtensionHandler triggers both global as well as per-API extension sequences. It reads the sequence names and invokes them accordinglyand determine what APIs need to be invoked.

By default, the extension handler is listed at last in the handler chain, and therefore is executed at 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 and provide the value top as follows:

<ExtensionHandlerPosition>top</ExtensionHandlerPosition>

This is useful when you want to execute your own extensions before our default handlers. For example, if you want to have additional security checks such as signature verification on access tokens before executing the default security handler, you can define an extension and configure the Gateway to execute extension handlers first.

For more information on Handlers, see  Architecture Components.