Skip to content
forked from apache/dubbo

Apache Dubbo (incubating) is a high-performance, java based, open source RPC framework.

License

Notifications You must be signed in to change notification settings

dxy9/incubator-dubbo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apache Dubbo (incubating) Project

Apache Dubbo(孵化)是一种基于Java的高性能开源RPC框架。请访问官方网站以获取快速入门和文档,以及Wiki获取新闻,常见问题和发行说明。我们现在正在收集dubbo用户信息,以帮助我们更好地改进Dubbo,请参阅。亲切地帮助我们提供你的问题#1012:通缉:谁在使用dubbo,谢谢:)

Architecture

Architecture

Features

  • 基于透明接口的RPC
  • 智能负载平衡
  • 自动服务注册和发现
  • 高扩展性
  • 运行时流量路由
  • 可视化的服务治理

Getting started

以下代码段来自Dubbo Samples。在继续阅读之前,您可以克隆示例项目并进入dubbo-samples-api子目录。

# git clone https://github.com/apache/incubator-dubbo-samples.git
# cd incubator-dubbo-samples/dubbo-samples-api

There's a README file under dubbo-samples-api directory. 阅读并按照说明尝试此示例。

Maven dependency

master分支的版本是 2.7.x

<properties>
    <dubbo.version>2.7.1</dubbo.version>
</properties>
    
<dependencies>
    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo</artifactId>
        <version>${dubbo.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-dependencies-zookeeper</artifactId>
        <version>${dubbo.version}</version>
        <type>pom</type>
    </dependency>
</dependencies>

Define service interfaces

package org.apache.dubbo.samples.api;

public interface GreetingService {
    String sayHello(String name);
}

See api/GreetingService.java on GitHub.

Implement service interface for the provider

package org.apache.dubbo.samples.provider;
 
import org.apache.dubbo.samples.api.GreetingService;
 
public class GreetingServiceImpl implements GreetingService {
    @Override
    public String sayHello(String name) {
        return "Hello " + name;
    }
}

See provider/GreetingServiceImpl.java on GitHub.

Start service provider

package org.apache.dubbo.demo.provider;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.samples.api.GreetingService;

import java.io.IOException;
 
public class Application {

    public static void main(String[] args) throws IOException {
        ServiceConfig<GreetingService> serviceConfig = new ServiceConfig<GreetingService>();
        serviceConfig.setApplication(new ApplicationConfig("first-dubbo-provider"));
        serviceConfig.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234"));
        serviceConfig.setInterface(GreetingService.class);
        serviceConfig.setRef(new GreetingServiceImpl());
        serviceConfig.export();
        System.in.read();
    }
}

See provider/Application.java on GitHub.

Build and run the provider

# mvn clean package
# mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.demo.provider.Application exec:java

Call remote service in consumer

package org.apache.dubbo.demo.consumer;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.samples.api.GreetingService;

public class Application {
    public static void main(String[] args) {
        ReferenceConfig<GreetingService> referenceConfig = new ReferenceConfig<GreetingService>();
        referenceConfig.setApplication(new ApplicationConfig("first-dubbo-consumer"));
        referenceConfig.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234"));
        referenceConfig.setInterface(GreetingService.class);
        GreetingService greetingService = referenceConfig.get();
        System.out.println(greetingService.sayHello("world"));
    }
}

Build and run the consumer

# mvn clean package
# mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.demo.consumer.Application exec:java

The consumer will print out Hello world on the screen.

See consumer/Application.java on GitHub.

Next steps

Building

If you want to try out the cutting-edge features, you can built with the following commands. (Java 1.8 is required to build the master branch)

  mvn clean install

Contact(联系)

Contributing

有关提交补丁和贡献工作流程的详细信息,请参阅贡献

How can I contribute?

Reporting bugs

Please follow the template for reporting any issues.

Reporting a security vulnerability(漏洞)

Please report security vulnerability to us privately.

Dubbo ecosystem(生态系统)

Language

License

Apache Dubbo is under the Apache 2.0 license. See the LICENSE file for details.

About

Apache Dubbo (incubating) is a high-performance, java based, open source RPC framework.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.8%
  • Other 0.2%