...
The above sequence prints a log message on the console whenever the TwitterSearch
API is invoked.
Selecting predefined APIs from the UI
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,
To populate these drop-down lists, you can write custom sequences using a tool like WSO2 Developer Studio and store the sequence.xml file in the API Manager governance registry. For more information, see
Invoking the extension sequences
...
For more information on Handlers, see Architecture Components.
Allowing publisher to select predefined sequences
When an API is created using the API Publisher Web interface, you can select its sequences.
User can design all sequences using Dev Studio or any other tool, and store the sequence.xml file in the governance registry. We have introduced a new registry collection to store the sequences file. For sequences, create "customsequences" collection at apimgt governance registry location. The registry path will be like " /_system/governance/apimgt/customsequences".
In the "customsequences" collection , user has to create two collections "in" and "out" for InSequences and OutSequences.
Info | ||
---|---|---|
| ||
If registry collection is not available, user has to create the collection prior to store the sequences. |
Store the InSequence files at apimgt/customsequences/in folder .
Info | ||
---|---|---|
| ||
If you have a in sequence file named as "testInSequence", you need to save the file in the following location ; /_system/governance/apimgt/customsequences/in/testInSequence.xml |
Store the OutSequence files at apimgt/customsequences/out folder .
Info | ||
---|---|---|
| ||
If you have a out sequence file named as "testOutSequence", you need to save the file here; /_system/governance/apimgt/customsequences/out/testOutSequence.xml |
After saving the files, these sequences will be visible at publisher webapp, when publisher try to create an API. User has to check the option at the UI to select a custom sequence for InFlow and OutFlow.
Those sequences will be renamed with the naming convention as described above and deployed to synapse when we publish the API to gateway.