zoukankan      html  css  js  c++  java
  • dubbo本地调试直连

    服务:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/context
             http://www.springframework.org/schema/context/spring-context.xsd
             http://code.alibabatech.com/schema/dubbo
             http://code.alibabatech.com/schema/dubbo/dubbo.xsd" default-autowire="byName">
    
        <dubbo:provider group="xxx"/>

    <!-- 提供方应用信息,用于计算依赖关系 -->
    <dubbo:application name="sports-basic-provider"/>

    <!-- 使用zookeeper注册中心暴露服务地址 -->
    <dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}"/>

    <!-- 使用dubbo协议在20880端口暴露服务 -->
    <dubbo:protocol name="dubbo" port="20880"/>

        <!-- basic start -->
        <dubbo:service interface="com.xxx.basic.manage.service.OrganizationService" ref="organizationService" timeout="10000"/>
        <dubbo:service interface="com.xxx.basic.manage.service.ResourceService" ref="resourceService" timeout="10000"/>
        <dubbo:service interface="com.xxx.basic.manage.service.SysRoleService" ref="sysRoleService" timeout="10000"/>
        <dubbo:service interface="com.xxx.basic.manage.service.SysUserService" ref="sysUserService" timeout="10000"/>
    
    </beans>

    增加三行黑色的

    消费端:

    consumer.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans.xsd
                http://code.alibabatech.com/schema/dubbo
                http://code.alibabatech.com/schema/dubbo/dubbo.xsd" default-autowire="byName">
    
        <dubbo:application name="${dubbo.application.name}"/>
        <dubbo:registry address="${dubbo.registry.address}" timeout="${dubbo.consumer.timeout}" />
        <dubbo:consumer retries="${dubbo.consumer.retries}" group="oa" />
    
        <!-- basic start -->
        <dubbo:reference  interface="com.xxx.basic.manage.service.SysRoleService" id="sysRoleService" check="false" url="dubbo://localhost:20880"/>
        <dubbo:reference  interface="com.xxx.basic.manage.service.ResourceService" id="resourceService" check="false" url="dubbo://localhost:20880" />
        <dubbo:reference  interface="com.xxx.basic.manage.service.OrganizationService" id="organizationService" check="false" url="dubbo://localhost:20880" />
        <dubbo:reference  interface="com.xxx.basic.manage.service.SysUserService" id="sysUserService" check="false" url="dubbo://localhost:20880"/>
       
    
    </beans>

    增加url="dubbo://localhost:20880"即可。

  • 相关阅读:
    聊聊 API Gateway 和 Netflix Zuul
    现行统编中学数学教科书有多烂
    线程池的成长之路
    Quick Guide to Microservices with Spring Boot 2.0, Eureka and Spring Cloud
    以太坊、Hyperledger Fabric和Corda,哪个更好?
    【SFA官方翻译】Spring WebFlux和Spring Cloud进行响应式微服务开发
    goroutine背后的系统知识
    goroutine与调度器
    MySQL命令,一篇文章替你全部搞定
    微服务架构技术栈选型手册(万字长文)
  • 原文地址:https://www.cnblogs.com/gmq-sh/p/7147798.html
Copyright © 2011-2022 走看看