Dubbo笔记

一、导包



    org.apache.dubbo
    dubbo-spring-boot-starter
    2.7.8



    org.apache.dubbo
    dubbo-dependencies-zookeeper
    2.7.8
    pom
    
        
            org.slf4j
            slf4j-log4j12
        
    

一、配置文件

(一)服务提供者

dubbo:
  registry:
    address: zookeeper://192.168.88.130:2181
    timeout: 250000
  scan:
    base-packages: com.example.dataservice.service.impl
  provider:
    timeout: 50000
    retries: 0 # 失败重试次数

(二)服务消费者 

dubbo:
  registry:
    address: zookeeper://192.168.88.130:2181
    timeout: 250000
  scan:
    base-packages: com.example.front
  consumer:
    check: false
    timeout: 50000
    retries: 0

二、@EnableDubbo

启动Dubbo,做用于SpringBoot启动类上;

三、远程调用

(一)服务提供者的Service

作用于ServiceImpl类上

@DubboService(interfaceClass = PlatBaseInfoService.class, version = "1.0")

 (二)服务消费者的Controller

作用于Controller类中的注入Service对象上

@DubboReference(interfaceClass = PlatBaseInfoService.class,version = "1.0")

你可能感兴趣的:(中间件,Java,中间件,Dubbo)