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-quickstart-example/README.md

1.8 KiB

Spring Cloud Polaris Quickstart example

English | 简体中文


Introduction

This example shows how to make application integrated with spring-cloud-tencent rapidly.

Instruction

Configuration

Modify bootstrap.yml, {ip} and {port} is the address of polaris server.

spring:
  application:
    name: EchoService
  cloud:
    polaris:
      address: grpc://${ip}:${port}

Start Application

Start Provider

  • Start in IDEA

Find main class EchoServerApplication in project polaris-quickstart-example/quickstart-provider, and execute the main method.

  • Start by fatjar

Run build command in polaris-quickstart-example/quickstart-provider:

mvn clean package

find the generated fatjar, run:

java -jar ${app.jar}

${app.jar} replace to the built jar name.

Start Consumer

  • Start in IDEA

Find main class EchoClientApplication in project polaris-quickstart-example/quickstart-consumer, and execute the main method.

  • Start by fatjar

Run build command in polaris-quickstart-example/quickstart-consumer:

mvn clean package

find the generated fatjar, run:

java -jar ${app.jar}

${app.jar} replace to the built jar name.

Verify

Invoke by http call

Consumer and Provider application use random generated port, so you need to record the consumer port from start log.

11:26:53 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 58838 (http) with context path ''

Invoke http callreplace ${app.port} to the consumer port.

curl -L -X GET 'http://localhost:47080/quickstart/feign?msg=hello_world''

expectecho: hello_world