All Projects → dubbo → Dubbo Registry Nacos

dubbo / Dubbo Registry Nacos

Licence: apache-2.0
Dubbo Registry for Alibaba Nacos

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Dubbo Registry Nacos

Nacos
an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
Stars: ✭ 20,691 (+20800%)
Mutual labels:  dubbo, service-discovery
Rsf
已作为 Hasor 的子项目,迁移到:http://git.oschina.net/zycgit/hasor
Stars: ✭ 77 (-22.22%)
Mutual labels:  dubbo, service-discovery
Spring Cloud Alibaba
Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
Stars: ✭ 20,934 (+21045.45%)
Mutual labels:  dubbo, service-discovery
Rpcx
Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱!
Stars: ✭ 6,516 (+6481.82%)
Mutual labels:  dubbo, service-discovery
Dubbo Arthas Demo
演示Arthas排查Dubbo问题的Demo
Stars: ✭ 83 (-16.16%)
Mutual labels:  dubbo
Javaall
这是一个Java开发宝典,所有的Java技术都在这里,用心学习,努力提升!
Stars: ✭ 67 (-32.32%)
Mutual labels:  dubbo
Nacos Group.github.io
nacos-group.github.io
Stars: ✭ 64 (-35.35%)
Mutual labels:  dubbo
Jeeplatform
一款企业信息化开发基础平台,拟集成OA(办公自动化)、CMS(内容管理系统)等企业系统的通用业务功能 JeePlatform项目是一款以SpringBoot为核心框架,集ORM框架Mybatis,Web层框架SpringMVC和多种开源组件框架而成的一款通用基础平台,代码已经捐赠给开源中国社区
Stars: ✭ 1,285 (+1197.98%)
Mutual labels:  dubbo
Microdot
Microdot: An open source .NET microservices framework
Stars: ✭ 1,222 (+1134.34%)
Mutual labels:  service-discovery
Ssm
销售系统项目,spring+spring mvc+mybatis+dubbo+kafka+redis+maven
Stars: ✭ 55 (-44.44%)
Mutual labels:  dubbo
Interface Test
接口测试工具,支持Dubbo、HTTP接口
Stars: ✭ 74 (-25.25%)
Mutual labels:  dubbo
Rpcx Java
rpcx implementation in Java for server side and client side
Stars: ✭ 71 (-28.28%)
Mutual labels:  dubbo
Spring Cloud Cloudfoundry
Integration between Cloudfoundry and the Spring Cloud APIs
Stars: ✭ 83 (-16.16%)
Mutual labels:  service-discovery
Eshop Soa
EShop基于Dubbo实现SOA服务化拆分,并基于RocketMQ解决了分布式事务(新版SpringBootSOASkeleton)
Stars: ✭ 65 (-34.34%)
Mutual labels:  dubbo
E3mall
宜立方商城,SOA架构学习项目
Stars: ✭ 91 (-8.08%)
Mutual labels:  dubbo
Spring Boot Extend
在springboot基础上的扩展项目,快速集成Zookeeper、Dubbo、Apollo、Mybatis多数据源
Stars: ✭ 63 (-36.36%)
Mutual labels:  dubbo
Microservice Patterns
Code to share the knowledge I gained while designing and implementing micro services
Stars: ✭ 87 (-12.12%)
Mutual labels:  service-discovery
Javacore
Java程序员所需要掌握的核心知识: 集合框架&JVM机制&多线程与并发框架&网络协议&Spring&Dubbo&MySQL&微服务等;希望胖友小手一抖,右上角来个 Star,感恩 1024
Stars: ✭ 73 (-26.26%)
Mutual labels:  dubbo
Dubbo Trace
基于Dubbo的分布式系统调用跟踪Demo
Stars: ✭ 72 (-27.27%)
Mutual labels:  dubbo
Dubbo Samples
samples for Apache Dubbo
Stars: ✭ 1,319 (+1232.32%)
Mutual labels:  dubbo

dubbo-registry-nacos

dubbo-registry-nacos is a Dubbo's registry implementation integrating with Nacos that is service registry server.

Prerequisite

Before you integrate dubbo-registry-nacos into your Dubbo project, you need to start a Nacos server in the backend. Refer to Nacos Quick Start for instructions on how to start a Nacos server.

Getting started

Maven dependency

<dependencies>

    ...
    
    <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
       <version>[3.2.18.RELEASE,)</version>
   </dependency>
    
    <!-- Dubbo dependency -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo</artifactId>
        <version>2.6.5</version>
    </dependency>
    
    <!-- Dubbo Nacos registry dependency -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo-registry-nacos</artifactId>
        <version>0.0.2</version>
    </dependency>   
    
    <!-- Keep latest Nacos client version -->
    <dependency>
        <groupId>com.alibaba.nacos</groupId>
        <artifactId>nacos-client</artifactId>
        <version>[0.6.1,)</version>
    </dependency>
    
    ...
    
</dependencies>

Define service interface

package com.alibaba.dubbo.demo.service;

public interface DemoService {
    String sayName(String name);
}

Implement service interface for the provider

package com.alibaba.dubbo.demo.service;

@Service(version = "${demo.service.version}")
public class DefaultService implements DemoService {

    @Value("${demo.service.name}")
    private String serviceName;

    public String sayName(String name) {
        RpcContext rpcContext = RpcContext.getContext();
        return String.format("Service [name :%s , port : %d] %s(\"%s\") : Hello,%s",
                serviceName,
                rpcContext.getLocalPort(),
                rpcContext.getMethodName(),
                name,
                name);
    }
}

Define service provider's configuration

## application
dubbo.application.name = dubbo-provider-demo

## Nacos registry address
dubbo.registry.address = nacos://127.0.0.1:8848

## Dubbo Protocol
dubbo.protocol.name = dubbo
dubbo.protocol.port = -1

# Provider @Service version
demo.service.version=1.0.0
demo.service.name = demoService

Start service provider

package com.alibaba.dubbo.demo.provider;

@EnableDubbo(scanBasePackages = "com.alibaba.dubbo.demo.service")
@PropertySource(value = "classpath:/provider-config.properties")
public class DemoServiceProviderBootstrap {

    public static void main(String[] args) throws IOException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(DemoServiceProviderBootstrap.class);
        context.refresh();
        System.out.println("DemoService provider starting...");
        System.in.read();
    }
}

See DemoServiceProviderBootstrap.java on GitHub.

Define service consumer's configuration

## Dubbo Application info
dubbo.application.name = dubbo-consumer-demo

## Nacos registry address
dubbo.registry.address = nacos://127.0.0.1:8848

# @Reference version
demo.service.version= 1.0.0

Start service consumer

package com.alibaba.dubbo.demo.consumer;

@EnableDubbo
@PropertySource(value = "classpath:/consumer-config.properties")
public class DemoServiceConsumerBootstrap {

    @Reference(version = "${demo.service.version}")
    private DemoService demoService;

    @PostConstruct
    public void init() {
        for (int i = 0; i < 10; i++) {
            System.out.println(demoService.sayName("Mercy"));
        }
    }

    public static void main(String[] args) throws IOException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(DemoServiceConsumerBootstrap.class);
        context.refresh();
        context.close();
    }
}

See DemoServiceConsumerBootstrap.java on GitHub.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].