Microgateway is a lightweight, distributed API proxy designed to enforce policies and business logic near the service end point. Microgateway runs with its own JRE. It contains assets such as API, application, policy, and alias definitions. Microgateway can be controlled using simple command line interface using start and stop commands. Microgateway contains a service for enforcing policy on REST API. Microgateway exposes REST APIs for querying status, system settings, and provisioned assets. Microgateway provides complete control over the landscape by facilitating enforcement of policies such as authentication, traffic monitoring and management.
This article explains how to provision Microgateways using Instance-based provisioning.
It is assumed that readers of this article are familiar with usage of API Gateway and understands Microgateway.
- Start API Gateway
- Configure few APIs
- Export of APIs and related assets from the API Gateway
The common usage of microservices and architectures based on microservices has increased the need for light weight gateways. The flexible deployment nature of Microgateway makes it ideal for low latency small footprint solutions.
Microgateway enables microservices to communicate with each other directly without the need for API Gateway. This eases the traffic overload on API Gateway and reduces the latency in the communication round trip. The required protection policies can be enforced on the Microgateway to establish a secure communication channel between the microservices.
Microgateway package can be created from an existing installation and can be copied to multiple target machines. Microgateway package contains all the essential artifacts required for running a microgateway.
The contents of Microgateway zip are
One or more exported API Gateway asset archives
There are two options to provision Microgateway for instance-based provisioning.
Pulling data from API Gateway
In this method all the configuration details are copied from API Gateway. There is not much flexibility for the user to modify the settings.
- Start Microgateway with sample APIs petstore and openWeather API
microgateway.bat start -p 8090 -gw* [ *http://host:port/rest/apigateway* ](http://host:port/rest/apigateway) *-gwu Administrator -gwp password -apis petstore,openWeather
- apis: List of APIs specified
- policies: List of global policies specified
- applications: List of global applications specified
The Microgateways provisioned using this method will appear in the default group.
Command to Stop Microgateway
microgateway.bat stop -p 8090
If no API details are provided in the command all APIs and associated assets are pulled from API Gateway.
Creating Microgateway instance using yml file
This method uses yml file to create an instance of Microgateway. The Microgateway can later be unzipped and used in target environments.
- Create the custom-settings.yml file using the below command
microgateway.bat downloadSettings -gw http://host:port/rest/apigateway -gwu Administrator -gwp password –-output my-custom-settings.yml
- Edit the yml file to add ports, API Gateway details, Microgateway pool details and archive details (archive created manually from API Gateway).
ports: http: "8054" https: "8053" api_gateway: url: "localhost:ISPort" user: "Administrator" password: "password" microgatewayPool: microgatewayPoolName: "DemoPool" microgatewayPoolDescription: "This is a Demo Pool" archive: file: "apigw-archive.zip"
Since the archive is created manually from API Gateway all associated assets are also pulled from the Gateway.
- Run the below command to create instance
microgateway.bat createInstance -c my-custom-settings.yml --instance C:\temp\Microgateway.zip -os win
- Open command prompt
- Unzip Microgateway.zip
- Start Microgateway using below command
microgateway.bat start --config my-custom-settings.yml
- Verify in API Gateway for the new Microgateway created
API to invoke Microgateway APIs:
Microgateway APIs can be invoked using URL
More information regarding configuration management can be found in the Microgateway_Configuration.docx.