Accessing Gateways

Spring Cloud supports gateways such as Netflix Zuul and Spring Cloud gateways. To connect them to the service registry and discovery center of Cloud Service Engine (CSE), you only need to import JAR packages and make simple configuration, but do not need to modify any code.

Getting Started

You can connect a gateway to the registry center in the same way as a common Spring Cloud application. No additional configuration is required. For details, see Using the Distributed Registry Center.

Running the Demo

The following shows how to access gateway services based on a project demo. spring-cloud-huawei-sample/gateway-demo is used to simulate the scenario where ServiceStage is used to migrate Spring Cloud and Zuul gateway services to the registry center of Apache ServiceComb.

  • backend-service: Backend service.
  • gateway-service: Spring Cloud gateway service.
  • zuul-service: Netflix Zuul gateway service.

Run the demo according to the following procedure:

  1. Download the local lightweight microservice engine, decompress it, and run start.bat. Then you can access the following address to go to the console.

    http://localhost:30106

  2. Respectively run the main function to start the three demo services.
  3. Access the following addresses:

    Access the service through the Spring Cloud gateway: http://127.0.0.1:8082/backend-service/hello

    Access the service through the Netflix Zuul gateway: http://127.0.0.1:8083/backend-service/hello

    Check whether the expected result is returned.

You are advised to use ServiceComb edge service gateways. Based on performance tests, Edge service gateways support higher concurrent traffic and provide better performance than Spring Cloud and Netflix Zuul gateways.