SkyeBeFreeman
baabb69be3
|
3 years ago | |
---|---|---|
.. | ||
discovery-callee-service | 3 years ago | |
discovery-caller-service | 3 years ago | |
README-zh.md | 3 years ago | |
README.md | 3 years ago | |
pom.xml | 3 years ago |
README.md
Spring Cloud Polaris Discovery example
Example Introduction
This example shows how to use ```spring-cloud-starter-tencent-polaris-discovery`` in Spring Cloud project for its features.
This example is divided to two microservice, discovery-caller-service and discovery-callee-service. In these two microservices, discovery-caller-service invokes discovery-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-discovery-example/discovery-caller-service
's DiscoveryCallerService
and spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service
's DiscoveryCalleeService
- Maven Package Launching
Execute under spring-cloud-tencent-examples/polaris-discovery-example
mvn clean package
Then at discovery-caller-service
and discovery-callee-service
find the package that generates jar, and run it
java -jar ${app.jar}
Launch application, change ${app.jar} to jar's package name
Verify
Feign Invoke
Execute the following orders to invoke Feign, DiscoveryCalleeService
goes bank to the sum of value1+value2
curl -L -X GET 'http://localhost:48080/discovery/service/caller/feign?value1=1&value2=2'
Expected return rate
3
RestTemplate Invoke
Execute the following orders to invoke RestTemplate, DiscoveryCalleeService
goes back to string characters
curl -L -X GET 'http://localhost:48080/discovery/service/caller/rest'
Expected return rate
Discovery Service Callee