Skip to content

Commit

Permalink
upgrate to latests version and add readme info (apache#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbc97 authored Dec 10, 2021
1 parent a77f15b commit 649eda2
Show file tree
Hide file tree
Showing 91 changed files with 187 additions and 155 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ A sample shows an application with basic login, download file, delete file funct
## java-chassis-samples
Featured samples for java-chassis modules. Each module contains 10 minutes guides.

## Precondition

Before running the samples,install [service center](https://github.com/apache/servicecomb-service-center) and [kie](https://github.com/apache/servicecomb-kie). Or download [Lightweight Cloud Service Engine](https://support.huaweicloud.com/devg-cse/cse_devg_0036.html) which integrates both serivce center and kie for ease of use.

# 使用ServiceComb开发微服务的示例项目

这个项目使用java-chassis 2.0.x版本。可以切换分支,查看其他版本的例子。
Expand All @@ -31,3 +35,8 @@ REST over Servlet。

## java-chassis-samples
java-chassis 各个模块功能的例子。每个子项目包含了10分钟可以学习完成的简单示例。

## 前提条件

运行这些例子之前,需要先安装[注册中心](https://github.com/apache/servicecomb-service-center)[配置中心](https://github.com/apache/servicecomb-kie) 。华为云提供一个出色的[本地轻量化微服务引擎](https://support.huaweicloud.com/devg-cse/cse_devg_0036.html) ,可以直接下载安装使用。

5 changes: 3 additions & 2 deletions ServiceComb-SpringMVC/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ This sample includes:
* src/main - this directory contains your Java service source files
* src/test - this directory contains your Java service unit test files

## Precondition
see [Precondition](../README.md)

## Getting Started

Clone your code repository and start developing your application on IDE of your choice
Expand All @@ -35,5 +38,3 @@ Clone your code repository and start developing your application on IDE of your
6. Open http://127.0.0.1:8080/rest/helloworld?name=hellworld in a web browser to view your application.

if you want to deploy the sample code on servicestage, View your CI/CD pipeline and service stack on ServiceStage and customize it as per your needs

## Contributing
2 changes: 1 addition & 1 deletion ServiceComb-SpringMVC/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-dependencies</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
7 changes: 2 additions & 5 deletions ServiceComb-SpringMVC/src/main/resources/microservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ cse:
address: http://127.0.0.1:30100
instance:
watch: false
config:
client:
serverUri: http://127.0.0.1:30113
refreshMode: 1
refresh_interval: 5000
kie:
serverUri: http://localhost:30110
#monitor:
#client:
#serverUri: https://cse.cn-north-1.myhuaweicloud.com
Expand Down
6 changes: 6 additions & 0 deletions basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ A Microserivce using Java Chassis with a REST interface. Consumer calls provider
* gateway
A Microserivce using Java Chassis Edge Service to forward requests to consumer.

## Precondition
see [Precondition](../README.md)
# Build and Run

* Build
Expand Down Expand Up @@ -38,6 +40,8 @@ A Microserivce using Java Chassis Edge Service to forward requests to consumer.

Open in browser: http://localhost:9090/sayHello?name=World



# 项目说明

这个项目提供了 Java Chassis 的简单例子,例子包括:
Expand Down Expand Up @@ -78,3 +82,5 @@ Open in browser: http://localhost:9090/sayHello?name=World
* 测试

启动3个微服务后, 然后通过界面访问: http://localhost:9090/sayHello?name=World


8 changes: 2 additions & 6 deletions basic/consumer/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ servicecomb:
# address: https://cse.cn-south-1.myhuaweicloud.com
instance:
watch: false
config:
client:
# Default using local config center
# serverUri: https://cse.cn-south-1.myhuaweicloud.com
serverUri: http://localhost:30113
refreshMode: 1
kie:
serverUri: http://localhost:30110

rest:
address: 0.0.0.0:9092 # should be same with server.port to use web container
Expand Down
8 changes: 2 additions & 6 deletions basic/gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ servicecomb:
# address: https://cse.cn-south-1.myhuaweicloud.com
instance:
watch: false
config:
client:
# Default using local config center
# serverUri: https://cse.cn-south-1.myhuaweicloud.com
serverUri: http://localhost:30113
refreshMode: 1
kie:
serverUri: http://localhost:30110

rest:
address: 0.0.0.0:9090?sslEnabled=false
Expand Down
2 changes: 1 addition & 1 deletion basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servicecomb.version>2.5.0</servicecomb.version>
<servicecomb.version>2.6.0</servicecomb.version>
</properties>

<dependencyManagement>
Expand Down
8 changes: 2 additions & 6 deletions basic/provider/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ servicecomb:
# address: https://cse.cn-south-1.myhuaweicloud.com
instance:
watch: false
config:
client:
# Default using local config center
# serverUri: https://cse.cn-south-1.myhuaweicloud.com
serverUri: http://localhost:30113
refreshMode: 1
kie:
serverUri: http://localhost:30110

rest:
address: 0.0.0.0:9093 # should be same with server.port to use web container
Expand Down
7 changes: 5 additions & 2 deletions java-chassis-deployment-samples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
This folder contains some examples of java-chassis deployments.
This folder contains some examples of java-chassis deployments.

* spring-boot-external-tomcat : deploy java-chassis with spring boot, but run in an external web container.
* war-external-tomcat : deploy java-chassis into a traditional war and run in an external web container.
* war-external-tomcat : deploy java-chassis into a traditional war and run in an external web container.

## Precondition
see [Precondition](../README.md)
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ Following are some useful articles to run spring boot in external web container.

For java-chassis using spring boot, check following articles.

* [Working with Spring Boot](https://docs.servicecomb.io/java-chassis/zh_CN/using-java-chassis-in-spring-boot/using-java-chassis-in-spring-boot/)
* [Working with Spring Boot](https://docs.servicecomb.io/java-chassis/zh_CN/using-java-chassis-in-spring-boot/using-java-chassis-in-spring-boot/)

## Precondition
see [Precondition](../../README.md)
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-dependencies</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-dependencies</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
8 changes: 6 additions & 2 deletions java-chassis-perfermance/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
suppose jar named perf.jar
## Precondition
see [Precondition](../README.md)

suppose jar named perf.jar
1.copy perf.jar to different directory

2.create microservice.yaml in each directory
Expand Down Expand Up @@ -42,4 +45,5 @@ redis:
java -jar perf.jar

4.start consumer
java -jar perf.jar -c
java -jar perf.jar -c

2 changes: 1 addition & 1 deletion java-chassis-perfermance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servicecomb.version>2.5.0</servicecomb.version>
<servicecomb.version>2.6.0</servicecomb.version>
<demo.main>org.apache.servicecomb.demo.perf.PerfMain</demo.main>
<vertx.version>3.8.3</vertx.version>
</properties>
Expand Down
5 changes: 4 additions & 1 deletion java-chassis-samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ It's the samples of Java chassis
4. code first sample
5. customer handler sample
6. extend metrics health checker sample
7. write metrics data into separate text files sample
7. write metrics data into separate text files sample

## Precondition
see [Precondition](../README.md)
2 changes: 1 addition & 1 deletion java-chassis-samples/apm-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>samples</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
3 changes: 3 additions & 0 deletions java-chassis-samples/auth-sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ servicecomb:
Consumer:
default: auth-provider
```
## Precondition
see [Precondition](../../README.md)
## Sample Quick Start
Expand Down Expand Up @@ -93,3 +95,4 @@ mvn exec:java -Dexec.mainClass="org.apache.servicecomb.samples.auth.consumer.Aut
On the consumer side, you can see the following outputs if the consumer can invoke the producer:
1. *'Hello Authenticate'* means the consumer calls sayhi with name=Authenticate successfully
2. *'Hello person ServiceComb/Authenticate'* means the consumer calls sayhello successfully

2 changes: 1 addition & 1 deletion java-chassis-samples/auth-sample/auth-consumer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>auth-sample</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>auth-consumer</artifactId>
<name>Java Chassis::Samples::Auth::Consumer</name>
Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/auth-sample/auth-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>auth-sample</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>auth-provider</artifactId>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/auth-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>samples</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>auth-sample</artifactId>
<name>Java Chassis::Samples::Auth</name>
Expand Down
3 changes: 3 additions & 0 deletions java-chassis-samples/bmi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ There are two microservices in this demo.
1. [Oracle JDK 1.8+](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html)
2. [Maven 3.x](https://maven.apache.org/install.html)
3. [Gradle 4.x](https://gradle.org/install/)(Optional)
## Precondition
see [Precondition](../../README.md)

## Quick Start(Linux)
* Run the service center
Expand Down Expand Up @@ -48,3 +50,4 @@ There are two microservices in this demo.
```

* Visit the services via **<a>http://127.0.0.1:8889</a>**.

2 changes: 1 addition & 1 deletion java-chassis-samples/bmi/calculator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>bmi</artifactId>
<groupId>org.apache.servicecomb.samples</groupId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/bmi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>samples</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>

<artifactId>bmi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/bmi/webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>bmi</artifactId>
<groupId>org.apache.servicecomb.samples</groupId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
5 changes: 4 additions & 1 deletion java-chassis-samples/codefirst-sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,7 @@ servicecomb:
3. *'Spring mvc Hello Java Chassis'* means the consumer calls SpringMvc sayhi successfully
4. *'Pojo Hello person ServiceComb/Java Chassis'* means the consumer calls sayhello successfully
5. *'Jaxrs Hello person ServiceComb/Java Chassis'* means the consumer calls Jaxrs sayhello successfully
6. *'Spring mvc Hello person ServiceComb/Java Chassis'* means the consumer calls SpringMvc sayhello successfully
6. *'Spring mvc Hello person ServiceComb/Java Chassis'* means the consumer calls SpringMvc sayhello successfully

## Precondition
see [Precondition](../../README.md)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>codefirst-sample</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>codefirst-consumer</artifactId>
<name>Java Chassis::Samples::CodeFirst::Consumer</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>codefirst-sample</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>codefirst-provider</artifactId>
<name>Java Chassis::Samples::CodeFirst::Provider</name>
Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/codefirst-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>samples</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>codefirst-sample</artifactId>
<name>Java Chassis::Samples::CodeFirst</name>
Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/common-schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>samples</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>common-schema</artifactId>
<name>Java Chassis::Samples::Common Schema</name>
Expand Down
3 changes: 3 additions & 0 deletions java-chassis-samples/config-apollo-sample/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Precondition
see [Precondition](../../README.md)

## Use Apollo as Configuration Center

To use Apollo as configuration source in ServiceComb Java Chassis services:
Expand Down
2 changes: 1 addition & 1 deletion java-chassis-samples/config-apollo-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>samples</artifactId>
<groupId>org.apache.servicecomb.samples</groupId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
5 changes: 5 additions & 0 deletions java-chassis-samples/custom-handler-sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ ServiceComb support users to define a customized handler and and invoke the hand
Consumer:
default: bizkeeper-consumer,loadbalance, myhandler
```
## Precondition
see [Precondition](../../README.md)
## Sample Quick Start
Expand Down Expand Up @@ -87,4 +90,6 @@ servicecomb:

On the consumer side, you can see the following outputs:
1. *'It's my handler!'* means custom handler had take effect



Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.servicecomb.samples</groupId>
<artifactId>custom-handler-sample</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>
<artifactId>custom-handler-consumer</artifactId>
<name>Java Chassis::Samples::Custom Handler::Consumer</name>
Expand Down
Loading

0 comments on commit 649eda2

Please sign in to comment.