diff --git a/dubbo-demo/README.md b/dubbo-demo/README.md index de43542497e..4cb99b72a95 100644 --- a/dubbo-demo/README.md +++ b/dubbo-demo/README.md @@ -1 +1,29 @@ +# 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/incubator-dubbo-samples) where you will find comprehensive usages for how to use Dubbo in different scenarios with the different features. + +## How To Build + +To build all demo applications from the source code, simply step into '*dubbo-demo*' directory and use maven to build: + +```bash +mvn clean package +``` + +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 + +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 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 dubbo-demo-api-consumer-${project.version}.jar +``` diff --git a/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-consumer/pom.xml b/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-consumer/pom.xml index 7e38ba1b435..c13bc265bc2 100644 --- a/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-consumer/pom.xml @@ -38,14 +38,6 @@ dubbo-demo-interface ${project.parent.version} - - org.apache.dubbo - dubbo-config-spring - - - org.apache.dubbo - dubbo-registry-zookeeper - org.apache.dubbo dubbo-registry-multicast @@ -56,23 +48,15 @@ org.apache.dubbo - dubbo-remoting-netty4 - - - org.apache.dubbo - dubbo-serialization-hessian2 - - - org.apache.dubbo - dubbo-configcenter-zookeeper + dubbo-config-spring org.apache.dubbo - dubbo-metadata-report-redis + dubbo-remoting-netty4 org.apache.dubbo - dubbo-metadata-report-zookeeper + dubbo-serialization-hessian2 diff --git a/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-provider/pom.xml b/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-provider/pom.xml index 9e807ce5d48..4f164bce61e 100644 --- a/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-annotation/dubbo-demo-annotation-provider/pom.xml @@ -30,6 +30,7 @@ true + 1.7.25 @@ -38,14 +39,6 @@ dubbo-demo-interface ${project.parent.version} - - org.apache.dubbo - dubbo-config-spring - - - org.apache.dubbo - dubbo-registry-zookeeper - org.apache.dubbo dubbo-registry-multicast @@ -56,27 +49,28 @@ org.apache.dubbo - dubbo-remoting-netty4 + dubbo-config-spring org.apache.dubbo - dubbo-serialization-hessian2 + dubbo-remoting-netty4 org.apache.dubbo - dubbo-configcenter-zookeeper + dubbo-serialization-hessian2 - org.apache.dubbo - dubbo-metadata-report-zookeeper + org.slf4j + slf4j-api - org.apache.dubbo - dubbo-metadata-report-redis + org.slf4j + slf4j-log4j12 + ${slf4j-log4j12.version} - org.apache.dubbo - dubbo-qos + log4j + log4j diff --git a/dubbo-demo/dubbo-demo-annotation/pom.xml b/dubbo-demo/dubbo-demo-annotation/pom.xml index df69c4c424b..81e7fbe8eae 100644 --- a/dubbo-demo/dubbo-demo-annotation/pom.xml +++ b/dubbo-demo/dubbo-demo-annotation/pom.xml @@ -30,6 +30,7 @@ true + 2.1.4.RELEASE @@ -37,5 +38,20 @@ dubbo-demo-annotation-consumer - + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + repackage + + + + + + diff --git a/dubbo-demo/dubbo-demo-api/dubbo-demo-api-consumer/pom.xml b/dubbo-demo/dubbo-demo-api/dubbo-demo-api-consumer/pom.xml index fd0f62631e4..f668a8540db 100644 --- a/dubbo-demo/dubbo-demo-api/dubbo-demo-api-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-api/dubbo-demo-api-consumer/pom.xml @@ -38,10 +38,6 @@ dubbo-demo-interface ${project.parent.version} - - org.apache.dubbo - dubbo-registry-zookeeper - org.apache.dubbo dubbo-registry-multicast @@ -58,18 +54,6 @@ org.apache.dubbo dubbo-serialization-hessian2 - - org.apache.dubbo - dubbo-configcenter-zookeeper - - - org.apache.dubbo - dubbo-metadata-report-redis - - - org.apache.dubbo - dubbo-metadata-report-zookeeper - diff --git a/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/pom.xml b/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/pom.xml index 095b43093fa..ff5d9ced5b7 100644 --- a/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/pom.xml @@ -18,7 +18,8 @@ ~ under the License. --> - + dubbo-demo-api org.apache.dubbo @@ -30,6 +31,7 @@ true + 1.7.25 @@ -38,10 +40,6 @@ dubbo-demo-interface ${project.parent.version} - - org.apache.dubbo - dubbo-registry-zookeeper - org.apache.dubbo dubbo-registry-multicast @@ -58,21 +56,19 @@ org.apache.dubbo dubbo-serialization-hessian2 + - org.apache.dubbo - dubbo-configcenter-zookeeper - - - org.apache.dubbo - dubbo-metadata-report-zookeeper + org.slf4j + slf4j-api - org.apache.dubbo - dubbo-metadata-report-redis + org.slf4j + slf4j-log4j12 + ${slf4j-log4j12.version} - org.apache.dubbo - dubbo-qos + log4j + log4j diff --git a/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java b/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java index c453d1b5543..857e03f1169 100644 --- a/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java +++ b/dubbo-demo/dubbo-demo-api/dubbo-demo-api-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java @@ -29,10 +29,9 @@ public class Application { * launch the application */ public static void main(String[] args) throws Exception { - System.setProperty("DUBBO_IP_TO_REGISTRY", "4.3.2.1"); ServiceConfig service = new ServiceConfig<>(); service.setApplication(new ApplicationConfig("dubbo-demo-api-provider")); - service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181")); + service.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234")); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); service.export(); diff --git a/dubbo-demo/dubbo-demo-api/pom.xml b/dubbo-demo/dubbo-demo-api/pom.xml index 944c76dd505..e78c2ca4e89 100644 --- a/dubbo-demo/dubbo-demo-api/pom.xml +++ b/dubbo-demo/dubbo-demo-api/pom.xml @@ -18,7 +18,8 @@ ~ under the License. --> - + dubbo-demo org.apache.dubbo @@ -34,9 +35,26 @@ true + 2.1.4.RELEASE dubbo-demo-api + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + repackage + + + + + + diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-consumer/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-consumer/pom.xml index 7eb47eef78e..4dfde790cfa 100644 --- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-consumer/pom.xml @@ -36,15 +36,11 @@ org.apache.dubbo - dubbo-config-spring - - - org.apache.dubbo - dubbo-registry-zookeeper + dubbo-registry-multicast org.apache.dubbo - dubbo-registry-multicast + dubbo-config-spring org.apache.dubbo @@ -58,17 +54,5 @@ org.apache.dubbo dubbo-serialization-hessian2 - - org.apache.dubbo - dubbo-configcenter-zookeeper - - - org.apache.dubbo - dubbo-metadata-report-redis - - - org.apache.dubbo - dubbo-metadata-report-zookeeper - diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml index 81cfe6c9d70..a93c41ccf00 100644 --- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml @@ -27,6 +27,7 @@ The demo provider module of dubbo project true + 1.7.25 @@ -35,14 +36,6 @@ dubbo-demo-interface ${project.parent.version} - - org.apache.dubbo - dubbo-config-spring - - - org.apache.dubbo - dubbo-registry-zookeeper - org.apache.dubbo dubbo-registry-multicast @@ -53,27 +46,28 @@ org.apache.dubbo - dubbo-remoting-netty4 + dubbo-config-spring org.apache.dubbo - dubbo-serialization-hessian2 + dubbo-remoting-netty4 org.apache.dubbo - dubbo-configcenter-zookeeper + dubbo-serialization-hessian2 - org.apache.dubbo - dubbo-metadata-report-zookeeper + org.slf4j + slf4j-api - org.apache.dubbo - dubbo-metadata-report-redis + org.slf4j + slf4j-log4j12 + ${slf4j-log4j12.version} - org.apache.dubbo - dubbo-qos + log4j + log4j diff --git a/dubbo-demo/dubbo-demo-xml/pom.xml b/dubbo-demo/dubbo-demo-xml/pom.xml index 97aa01023bf..f75b2eca752 100644 --- a/dubbo-demo/dubbo-demo-xml/pom.xml +++ b/dubbo-demo/dubbo-demo-xml/pom.xml @@ -31,6 +31,7 @@ true + 2.1.4.RELEASE @@ -38,4 +39,21 @@ dubbo-demo-xml-consumer + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + repackage + + + + + + + diff --git a/dubbo-distribution/pom.xml b/dubbo-distribution/pom.xml index 07fdf356d4f..1ab955cc3e9 100644 --- a/dubbo-distribution/pom.xml +++ b/dubbo-distribution/pom.xml @@ -32,323 +32,14 @@ org.apache.dubbo - dubbo-cluster + dubbo-demo-api-provider ${project.version} org.apache.dubbo - dubbo-common + dubbo-demo-api-consumer ${project.version} - - org.apache.dubbo - dubbo-config-api - ${project.version} - - - org.apache.dubbo - dubbo-config-spring - ${project.version} - - - org.apache.dubbo - dubbo-filter-cache - ${project.version} - - - org.apache.dubbo - dubbo-filter-validation - ${project.version} - - - org.apache.dubbo - dubbo-remoting-api - ${project.version} - - - org.apache.dubbo - dubbo-remoting-netty - ${project.version} - - - org.apache.dubbo - dubbo-remoting-netty4 - ${project.version} - - - org.apache.dubbo - dubbo-remoting-mina - ${project.version} - - - org.apache.dubbo - dubbo-remoting-grizzly - ${project.version} - - - org.apache.dubbo - dubbo-remoting-p2p - ${project.version} - - - org.apache.dubbo - dubbo-remoting-http - ${project.version} - - - org.apache.dubbo - dubbo-rpc-api - ${project.version} - - - org.apache.dubbo - dubbo-rpc-dubbo - ${project.version} - - - org.apache.dubbo - dubbo-rpc-injvm - ${project.version} - - - org.apache.dubbo - dubbo-rpc-jsonrpc - ${project.version} - - - org.apache.dubbo - dubbo-rpc-rmi - ${project.version} - - - org.apache.dubbo - dubbo-rpc-hessian - ${project.version} - - - org.apache.dubbo - dubbo-rpc-http - ${project.version} - - - org.apache.dubbo - dubbo-rpc-webservice - ${project.version} - - - org.apache.dubbo - dubbo-rpc-thrift - ${project.version} - - - org.apache.dubbo - dubbo-rpc-native-thrift - ${project.version} - - - org.apache.dubbo - dubbo-rpc-memcached - ${project.version} - - - org.apache.dubbo - dubbo-rpc-redis - ${project.version} - - - org.apache.dubbo - dubbo-rpc-rest - ${project.version} - - - org.apache.dubbo - dubbo-registry-api - ${project.version} - - - org.apache.dubbo - dubbo-registry-default - ${project.version} - - - org.apache.dubbo - dubbo-registry-multicast - ${project.version} - - - org.apache.dubbo - dubbo-registry-zookeeper - ${project.version} - - - org.apache.dubbo - dubbo-registry-redis - ${project.version} - - - org.apache.dubbo - dubbo-registry-consul - ${project.version} - - - org.apache.dubbo - dubbo-registry-nacos - ${project.version} - - - org.apache.dubbo - dubbo-registry-etcd3 - ${project.version} - - - org.apache.dubbo - dubbo-registry-sofa - ${project.version} - - - org.apache.dubbo - dubbo-configcenter-api - ${project.version} - - - org.apache.dubbo - dubbo-configcenter-zookeeper - ${project.version} - - - org.apache.dubbo - dubbo-configcenter-apollo - ${project.version} - - - org.apache.dubbo - dubbo-configcenter-consul - ${project.version} - - - org.apache.dubbo - dubbo-configcenter-etcd - ${project.version} - - - org.apache.dubbo - dubbo-metadata-report-api - ${project.version} - - - org.apache.dubbo - dubbo-metadata-report-zookeeper - ${project.version} - - - org.apache.dubbo - dubbo-metadata-report-redis - ${project.version} - - - org.apache.dubbo - dubbo-metadata-report-consul - ${project.version} - - - org.apache.dubbo - dubbo-metadata-report-etcd - ${project.version} - - - org.apache.dubbo - dubbo-monitor-api - ${project.version} - - - org.apache.dubbo - dubbo-monitor-default - ${project.version} - - - org.apache.dubbo - dubbo-container-spring - ${project.version} - - - org.apache.dubbo - dubbo-container-log4j - ${project.version} - - - org.apache.dubbo - dubbo-container-logback - ${project.version} - - - org.apache.dubbo - dubbo-qos - ${project.version} - - - org.apache.dubbo - dubbo-serialization-api - ${project.version} - - - org.apache.dubbo - dubbo-serialization-fastjson - ${project.version} - - - org.apache.dubbo - dubbo-serialization-fst - ${project.version} - - - org.apache.dubbo - dubbo-serialization-hessian2 - ${project.version} - - - org.apache.dubbo - dubbo-serialization-native-hession - ${project.version} - - - org.apache.dubbo - dubbo-serialization-jdk - ${project.version} - - - org.apache.dubbo - dubbo-serialization-kryo - ${project.version} - - - org.apache.dubbo - dubbo-serialization-protostuff - ${project.version} - - - org.apache.dubbo - dubbo-serialization-avro - ${project.version} - - - org.apache.dubbo - dubbo-serialization-gson - ${project.version} - - - org.apache.dubbo - dubbo - ${project.version} - - - org.apache.dubbo - dubbo-compatible - ${project.version} - - - com.alibaba - hessian-lite - diff --git a/dubbo-distribution/src/assembly/bin-release.xml b/dubbo-distribution/src/assembly/bin-release.xml index e0aef5cbca7..76409930e6d 100644 --- a/dubbo-distribution/src/assembly/bin-release.xml +++ b/dubbo-distribution/src/assembly/bin-release.xml @@ -31,20 +31,23 @@ LICENSE + + ../dubbo-demo + + README.md + + true false - /libs + /dubbo-demo runtime - org.apache.dubbo:* + org.apache.dubbo:dubbo-demo-api* - - com.alibaba:fastjson -