项目作者: mydevotion

项目描述 :
dubbo的源码注释
高级语言: Java
项目地址: git://github.com/mydevotion/dubbo.git
创建时间: 2017-01-03T12:57:33Z
项目社区:https://github.com/mydevotion/dubbo

开源协议:Apache License 2.0

下载


Build Status Gitter

Dubbo is a distributed, high performance RPC framework which empowers applications with service import/export capabilities.

It contains three key parts, which include:

  • Remoting: a network communication framework providing sync-over-async and request-response messaging.
  • Clustering: a remote procedure call abstraction with load-balancing/failover/clustering capabilities.
  • Registration: a service directory framework for service registration and service event publish/subscription

For more details, please refer to wiki or dubbo.io.

Quick Start

Export service:

  1. <bean id="barService" class="com.foo.BarServiceImpl" ></bean>
  2. <dubbo:service interface="com.foo.BarService" ref="barService" ></dubbo:service>

Refer to service:

  1. <dubbo:reference id="barService" interface="com.foo.BarService" ></dubbo:reference>
  2. <bean id="barAction" class="com.foo.BarAction">
  3. <property name="barService" ref="barService" ></property>
  4. </bean>

Source Building

  1. Install the git and maven command line:

    1. yum install git
    2. or: apt-get install git
    3. cd ~
    4. wget http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz
    5. tar zxvf apache-maven-2.2.1-bin.tar.gz
    6. vi .bash_profile
    7. append: export PATH=$PATH:~/apache-maven-2.2.1/bin
    8. source .bash_profile
  2. Checkout the dubbo source code:

    1. cd ~
    2. git clone https://github.com/alibaba/dubbo.git dubbo
    3. git checkout master
    4. or: git checkout -b dubbo-2.4.0
  3. Import the dubbo source code to eclipse project:

    1. cd ~/dubbo
    2. mvn eclipse:eclipse

    Then configure the project in eclipse by following the steps below:

    • Eclipse -> Menu -> File -> Import -> Exsiting Projects to Workspace -> Browse -> Finish
    • Context Menu -> Run As -> Java Application:
      • dubbo-demo-provider/src/test/java/com.alibaba.dubbo.demo.provider.DemoProvider
      • dubbo-demo-consumer/src/test/java/com.alibaba.dubbo.demo.consumer.DemoConsumer
      • dubbo-monitor-simple/src/test/java/com.alibaba.dubbo.monitor.simple.SimpleMonitor
      • dubbo-registry-simple/src/test/java/com.alibaba.dubbo.registry.simple.SimpleRegistry
    • Edit Config:
      • dubbo-demo-provider/src/test/resources/dubbo.properties
      • dubbo-demo-consumer/src/test/resources/dubbo.properties
      • dubbo-monitor-simple/src/test/resources/dubbo.properties
      • dubbo-registry-simple/src/test/resources/dubbo.properties
  4. Build the dubbo binary package:

    1. cd ~/dubbo
    2. mvn clean install -Dmaven.test.skip
    3. cd dubbo/target
    4. ls
  5. Install the demo provider:

    1. cd ~/dubbo/dubbo-demo-provider/target
    2. tar zxvf dubbo-demo-provider-2.4.0-assembly.tar.gz
    3. cd dubbo-demo-provider-2.4.0/bin
    4. ./start.sh
  6. Install the demo consumer:

    1. cd ~/dubbo/dubbo-demo-consumer/target
    2. tar zxvf dubbo-demo-consumer-2.4.0-assembly.tar.gz
    3. cd dubbo-demo-consumer-2.4.0/bin
    4. ./start.sh
    5. cd ../logs
    6. tail -f stdout.log
  7. Install the simple monitor:

    1. cd ~/dubbo/dubbo-simple-monitor/target
    2. tar zxvf dubbo-simple-monitor-2.4.0-assembly.tar.gz
    3. cd dubbo-simple-monitor-2.4.0/bin
    4. ./start.sh
    5. http://127.0.0.1:8080
  8. Install the simple registry:

    ```sh
    cd ~/dubbo/dubbo-simple-registry/target
    tar zxvf dubbo-simple-registry-2.4.0-assembly.tar.gz
    cd dubbo-simple-registry-2.4.0/bin
    ./start.sh
    cd ~/dubbo/dubbo-demo-provider/conf
    vi dubbo.properties

  • edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090
    cd ../bin
    ./restart.sh
    cd ~/dubbo/dubbo-demo-consumer/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090
    cd ../bin
    ./restart.sh
    cd ~/dubbo/dubbo-simple-monitor/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090
    cd ../bin
    ./restart.sh
    ```
  1. Install the zookeeper registry:

    ```sh
    cd ~
    wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gz
    tar zxvf zookeeper-3.3.3.tar.gz
    cd zookeeper-3.3.3/conf
    cp zoo_sample.cfg zoo.cfg
    vi zoo.cfg

  • edit: dataDir=/home/xxx/data
    cd ../bin
    ./zkServer.sh start
    cd ~/dubbo/dubbo-demo-provider/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181
    cd ../bin
    ./restart.sh
    cd ~/dubbo/dubbo-demo-consumer/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181
    cd ../bin
    ./restart.sh
    cd ~/dubbo/dubbo-simple-monitor/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181
    cd ../bin
    ./restart.sh
    ```
  1. Install the redis registry:

    ```sh
    cd ~
    wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
    tar xzf redis-2.4.8.tar.gz
    cd redis-2.4.8
    make
    nohup ./src/redis-server redis.conf &
    cd ~/dubbo/dubbo-demo-provider/conf
    vi dubbo.properties

  • edit: dubbo.registry.adddress=redis://127.0.0.1:6379
    cd ../bin
    ./restart.sh
    cd ~/dubbo/dubbo-demo-consumer/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=redis://127.0.0.1:6379
    cd ../bin
    ./restart.sh
    cd ~/dubbo/dubbo-simple-monitor/conf
    vi dubbo.properties
  • edit: dubbo.registry.adddress=redis://127.0.0.1:6379
    cd ../bin
    ./restart.sh
    ```
  1. Install the admin console:

    1. cd ~/dubbo/dubbo-admin
    2. mvn jetty:run -Ddubbo.registry.address=zookeeper://127.0.0.1:2181
    3. http://root:root@127.0.0.1:8080