You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-cloud-tencent/spring-cloud-tencent-examples/polaris-gateway-example
Haotian Zhang 9d5cf90d35
fix:fix transfer http headers not working bug. (#665)
2 years ago
..
gateway-callee-service feat:optimize examples. (#577) 2 years ago
gateway-callee-service2 feat:optimize examples. (#577) 2 years ago
gateway-scg-service fix:fix transfer http headers not working bug. (#665) 2 years ago
README-zh.md docs:update docs 3 years ago
README.md Update README.md (#381) 2 years ago
pom.xml support spring cloud gateway routers (#388) 2 years ago

README.md

Spring Cloud Polaris Gateway example

Example Introduction

This example shows how to use spring-cloud-tencent-polaris-gateway in Spring Cloud project for its features.

This example contains gateway-zuul-service, gateway-scg-service and gateway-callee-service. gateway-zuul-service and gateway-scg-service invoke gateway-callee-service.

Instruction

Configuration

The configuration is as the following shows. {ip} and {port} are Polaris backend IP address and port number.

spring:
  application:
    name: ${application.name}
  cloud:
    polaris:
      address: ${ip}:${port}

Launching Example

Launching Polaris Backend Service

Reference to Polaris Getting Started

Launching Application

  • IDEA Launching

Launching spring-cloud-tencent-examples/polaris-gateway-example/gateway-zuul-service's GatewayZuulService, spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service's GatewayScgService and spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service's GatewayCalleeService

  • Maven Package Launching

Execute under spring-cloud-tencent-examples/polaris-gateway-example

mvn clean package

Then find the jars under gateway-zuul-service, gateway-scg-service and gateway-callee-service, and run it:

java -jar ${app.jar}

Launch application, change ${app.jar} to jar's package name.

Verify

Zuul Invoke

curl -L -X GET 'http://localhost:48082/GatewayCalleeService/gateway/example/callee/echo' -H 'SCT-CUSTOM-METADATA: {"b": 2}'

Expected return rate

{"a":"1","b":2}

Spring-Cloud-Gateway Invoke

curl -L -X GET 'http://localhost:48083/GatewayCalleeService/gateway/example/callee/echo' -H 'SCT-CUSTOM-METADATA: {"b": 2}'

Expected return rate

{"a":"1","b":2}

Gateway Rate Limit

See Polaris RateLimit Example