Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions dubbo-demo/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
# Dubbo Demo

This directory contains basic usages of Dubbo to help Dubbo developers for debugging and smoke test purpose. If you are looking for Dubbo samples for study purpose, you should look into [here](https://github.com/apache/dubbo-samples) where you will find comprehensive usages for how to use Dubbo in different scenarios with the different features.
This directory contains basic usages of Dubbo to help Dubbo developers for debugging and smoke test purpose. If you are looking for Dubbo samples for study purpose, you should look into here where you will find comprehensive usages for how to use Dubbo in different scenarios with the different features.

## How To Build
## Brief introduction

To build all demo applications from the source code, simply step into '*dubbo-demo*' directory and use maven to build:
Dubbo provides three demos that illustrate different usage scenarios:

```bash
mvn clean package
```
1. **`dubbo-demo-api`**
This demo demonstrates the basic usage of Dubbo, serving as a fundamental example. It showcases how to define and implement a simple service using Dubbo, along with how to register and consume the service. This is a great starting point for understanding core concepts in Dubbo, such as interface definitions, service exposure, and service consumption.
2. **`dubbo-demo-springboot`**
This demo illustrates the integration of Dubbo with Spring Boot, showing how Dubbo services can be utilized and configured within a Spring Boot application. It demonstrates how to configure and manage Dubbo services seamlessly through Spring Boot, making it ideal for developers leveraging the popular Spring Boot framework.
3. **`dubbo-demo-springboot-idl`**
This demo focuses on showcasing how to use Dubbo with Spring Boot when IDL (Interface Definition Language) files such as Proto files are available. It illustrates how developers can work with Dubbo services defined through IDL, integrating them into a Spring Boot application.

After build completes, a couple of fat jars are generated under '*target*' directory under each module directories, for example: '*dubbo-demo-api-provider-${project.version}.jar*' can be found under the directory '*dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/target*'.
## How to run

## How To Run

Since the generated artifacts are fat jars backed by spring boot maven plugin, they can be executed directly with '*java -jar*', and since multicast is used for service registration, a necessary system property '**-Djava.net.preferIPv4Stack=true**' is required in order to registry and discover the demo service properly.

Use '*dubbo-demo/dubbo-demo-api*' as an example, to start the provider '*dubbo-demo-api-provider*', execute the following command:

```bash
java -Djava.net.preferIPv4Stack=true -jar dubbo-demo-api-provider-${project.version}.jar
```

To run the consumer '*dubbo-demo-api-consumer*', execute the following command:

```bash
java -Djava.net.preferIPv4Stack=true -jar dubbo-demo-api-consumer-${project.version}.jar
```
First, you need to set up Zookeeper as the registry center. Use the `cd` command to navigate to the specific module directory, then run `mvn clean compile` (particularly for the `dubbo-demo-springboot-idl` module, as code generated from the proto files is located in the target directory). Start the provider first, followed by the consumer, to experience the functionality of Dubbo.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading