This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 1230c5282 update quickstart
new c034741c4 Merge remote-tracking branch 'origin/master'
1230c5282 is described below
commit 1230c52826bc23655bad73fcfa2b344f8016d218
Author: chickenlj <[email protected]>
AuthorDate: Tue Sep 17 09:00:49 2024 +0800
update quickstart
---
11-quickstart/README.md | 26 ++++++++++++++--------
11-quickstart/pom.xml | 2 +-
11-quickstart/quickstart-service/pom.xml | 5 -----
.../quickstart/dubbo/consumer/Consumer.java | 4 ++--
.../src/main/resources/application.yml | 3 +++
5 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/11-quickstart/README.md b/11-quickstart/README.md
index 5cbbb8aa1..23a3be850 100644
--- a/11-quickstart/README.md
+++ b/11-quickstart/README.md
@@ -1,5 +1,5 @@
# Getting Started
-This project is generated by
[start.dubbo.apache.org](https://start.dubbo.apache.org/) and used as the
demonstration code of the quick-start on our official website
[dubbo.apache.org](https://dubbo.apache.org/zh-cn/overview/mannual/java-sdk/quick-start/microservice/starter/).
+This project is generated by
[start.dubbo.apache.org](https://start.dubbo.apache.org/) and used as the
demonstration code of the quick-start on our official website
[dubbo.apache.org](https://dubbo.apache.org/zh-cn/overview/mannual/java-sdk/quick-start/starter/).
Check more samples from other directories like [1-basic](../1-basic),
[2-advanced](../2-advanced), etc.
@@ -9,7 +9,7 @@ Check more samples from other directories like
[1-basic](../1-basic), [2-advance
Step into '11-quickstart' directory, run the following command:
```shell
-$ mvn clean install
+$ ./mvnw clean install
```
This will install all the modules especially `quickstart-api` in the local
maven repo.
@@ -22,7 +22,7 @@ $ cd 11-quickstart/quickstart-service
then, run the following command to start Dubbo process:
```shell
-$ mvn compile exec:java
-Dexec.mainClass="org.apache.dubbo.samples.quickstart.QuickStartApplication"
+$ ./mvnw compile -pl quickstart-service exec:java
-Dexec.mainClass="org.apache.dubbo.samples.quickstart.QuickStartApplication"
```
Run the following command to see server works as expected:
@@ -33,6 +33,15 @@ $ curl \
http://localhost:50051/org.apache.dubbo.samples.quickstart.dubbo.api.DemoService/sayHello/
```
+或者
+
+```shell
+curl \
+ --header "Content-Type: application/json" \
+ --data '{"name":"Dubbo"}' \
+
http://localhost:50051/org.apache.dubbo.samples.quickstart.dubbo.api.DemoService/sayHello/
+```
+
## Publish service definition
Publish the Dubbo service definition(java interface) in `quickstart-api` to
maven repository so that consumers that need to call this service can import
the definition by importing `quickstart-api` maven dependency in their pom.xml.
@@ -42,13 +51,12 @@ $ cd 11-quickstart/quickstart-api
$ mvn clean deploy
```
+## Deploy on Kubernetes
+
+
+
## Reference Documentation
For further reference, please consider the following sections:
-
-* [Official Apache Maven
documentation](https://maven.apache.org/guides/index.html)
-* [Spring Boot Maven Plugin Reference
Guide](https://docs.spring.io/spring-boot/docs/3.1.2/maven-plugin/reference/html/)
-* [Create an OCI
image](https://docs.spring.io/spring-boot/docs/3.1.2/maven-plugin/reference/html/#build-image)
-* [Dubbo Zookeeper registry configuration
reference](https://dubbo.apache.org/zh-cn/overview/mannual/java-sdk/reference-manual/registry/zookeeper/)
+* [Use Nacos for service
discovery](https://dubbo.apache.org/zh-cn/overview/mannual/java-sdk/tasks/service-discovery/nacos/)
* [Dubbo triple protocol
reference](https://dubbo.apache.org/zh-cn/overview/mannual/java-sdk/reference-manual/protocol/triple/)
-* [Dubbo Zookeeper registry configuration
reference](https://docs.spring.io/spring-boot/docs/3.1.2/reference/htmlsingle/#web.servlet.spring-mvc.template-engines)
diff --git a/11-quickstart/pom.xml b/11-quickstart/pom.xml
index 590286ae9..d03a9b49d 100644
--- a/11-quickstart/pom.xml
+++ b/11-quickstart/pom.xml
@@ -12,7 +12,7 @@
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <dubbo.version>3.3.0-beta.5</dubbo.version>
+ <dubbo.version>3.3.0</dubbo.version>
<spring-boot.version>3.2.3</spring-boot.version>
</properties>
diff --git a/11-quickstart/quickstart-service/pom.xml
b/11-quickstart/quickstart-service/pom.xml
index 489a44e4b..5df72b72d 100644
--- a/11-quickstart/quickstart-service/pom.xml
+++ b/11-quickstart/quickstart-service/pom.xml
@@ -32,11 +32,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>3.19.6</version>
- </dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>quickstart-api</artifactId>
diff --git
a/11-quickstart/quickstart-service/src/main/java/org/apache/dubbo/samples/quickstart/dubbo/consumer/Consumer.java
b/11-quickstart/quickstart-service/src/main/java/org/apache/dubbo/samples/quickstart/dubbo/consumer/Consumer.java
index 257fdff58..11828a23c 100644
---
a/11-quickstart/quickstart-service/src/main/java/org/apache/dubbo/samples/quickstart/dubbo/consumer/Consumer.java
+++
b/11-quickstart/quickstart-service/src/main/java/org/apache/dubbo/samples/quickstart/dubbo/consumer/Consumer.java
@@ -25,12 +25,12 @@ import org.springframework.stereotype.Component;
@Component
public class Consumer implements CommandLineRunner {
- @DubboReference
+ // scope="remote" is used to force mock remote service call
+ @DubboReference(scope = "remote")
private DemoService demoService;
@Override
public void run(String... args) throws Exception {
-
String result = demoService.sayHello("world");
System.out.println("Receive result ======> " + result);
}
diff --git
a/11-quickstart/quickstart-service/src/main/resources/application.yml
b/11-quickstart/quickstart-service/src/main/resources/application.yml
index a3a18429a..08dffbb12 100644
--- a/11-quickstart/quickstart-service/src/main/resources/application.yml
+++ b/11-quickstart/quickstart-service/src/main/resources/application.yml
@@ -15,6 +15,9 @@
dubbo:
registry:
address:
nacos://${nacos.address:127.0.0.1}:8848?username=nacos&password=nacos
+ # This will enable application-level service discovery only (the
recommended service discovery method for Dubbo3).
+ # For users upgrading from Dubbo2.x, please set the value to 'all' for
smooth migration.
+ register-mode: instance
protocol:
name: tri
port: 50051
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]