The API Manager Microgateway is a specialized form of the WSO2 API Gateway. Its main characteristics are:
- The ability to execute in isolation without mandatory connections to other components (Key Manager, Traffic Manager, etc).
- The ability to host only a subset of specific APIs (defined in the API Publisher), instead of all.
- Immutability; if you update an API, you need to re-create the container/instance and hot deployment is not possible.
Microgateway offers you a proxy that is capable of performing security validations (OAuth, Signed JWT), in-memory (local) rate limiting and operational analytics.
Before you begin,
- Download the Microgateway distribution and extract it.
- Optionally, Identify the path to the bin folder of the extracted Microgateway. To avoid typing the whole path to the /bin folder of the microgateway each time the microgateway needs to be started, on the CLI, add the /bin folder path as a PATH environment variable.
If you are unable to append the path, you can alternatively run the Microgateway commands by navigating to the
<MICROGW_HOME>/bin folder and running the commands as
Let's go through the main use case of the Microgateway:
Deploy and subscribe to the sample API
Open the API Publisher (
https://<hostname>:9443/publisher) and sign in with
Click the Deploy Sample API button. It deploys a sample API called
PizzaShackAPIinto the API Manager.
The Deploy Sample API option is available only when there are no APIs in API Publisher. If you have already created a API, this option is not available.
PizzaShackAPIto open it.
- Go to the Lifecycle tab and note that the State is
PUBLISHED. The API is already published to the API Store.
- Sign in to the API Store (
https://<hostname>:9443/store) with the
admin/admincredentials and click the
- Expand the API Credentials section.
- Select the Express Mode.
- Give an application name and click Next to go to step 2.
- At Step 2, Click Next again and go to step 3.
- Click Next at step 3 to go to step 4.
- On step 5, copy the access token created and click Finish.
- Click on the Overview tab and expand the API Credentials sections to view the subscriptions.
Generate a distribution for a single API
It is possible to create a Microgateway distribution for a single API that is in the Published state.
For details on how to create a Microgateway distribution for a group of APIs, see Grouping APIs with Labels.
- Navigate to a preferred workspace folder using the command line.
This location is used to run the Microgateway commands and to generate Microgateway artifacts.
Set up a project using the command given below,
When the tool requests for the username and password, use
adminin both instances. Use the default values for the other parameters by pressing Enter.
Here is an example:
When the above command is issued, the tool connects with API Manager REST APIs and retrieves the API specified above. The source artifacts are generated in the current folder location.
The folder structure looks similar to the following,
If you re-run the setup command while you already have a project named
pizzashack-projectin the current working directory, you receive an error similar to the following:
As suggested in the above output, if you need to override the current project, run the setup command with the
Build the microgateway distribution for the project using the following command:
Here is an example:
Once the above command is executed, the generated source files are built and a Microgateway distribution is created in the
The name of the distribution will have the format
micro-gw-<project_name>.zip. In the above example, the name will be
Next, unzip the
-project.zipand run the
gatewayshell script inside the
binfolder of the extracted zip using the following command:
The Microgateway will now start for the Pizzashack API. For example,
You have successfully generated and started a Microgateway distribution for the Pizzashack API.