├── dubbo-dev-book-en ├── introduction.md ├── .gitignore ├── sources │ └── images │ │ ├── ddd.jpg │ │ ├── close-expand.jpg │ │ ├── design-step1.png │ │ ├── design-step2.png │ │ ├── design-step3.png │ │ ├── design-step4.png │ │ ├── dubbo-export.jpg │ │ ├── dubbo-modules.jpg │ │ ├── dubbo-refer.jpg │ │ ├── filter-chain.jpg │ │ ├── mix-api-spi.jpg │ │ ├── open-expand.jpg │ │ ├── dubbo-extension.jpg │ │ ├── dubbo-framework.jpg │ │ ├── dubbo-protocol.jpg │ │ ├── dubbo-relation.jpg │ │ ├── dubbo_rpc_refer.jpg │ │ ├── event-listener.jpg │ │ ├── dubbo_rpc_export.jpg │ │ ├── dubbo_rpc_invoke.jpg │ │ ├── seperate-api-spi.jpg │ │ ├── configuration-override.png │ │ └── dubbo_protocol_header.jpg ├── README.md ├── impls │ ├── introduction.md │ ├── merger.md │ ├── compiler.md │ ├── container.md │ ├── extension-factory.md │ ├── networker.md │ ├── router.md │ ├── page.md │ ├── threadpool.md │ ├── invoker-listener.md │ ├── exporter-listener.md │ ├── proxy-factory.md │ ├── dispatcher.md │ ├── load-balance.md │ └── validation.md ├── checklist.md ├── contract.md └── TCK.md ├── dubbo-admin-book ├── ops │ ├── introduction.md │ └── dubbo-ops.md ├── README.md ├── sources │ └── images │ │ ├── dubbo-search.png │ │ ├── dubbo-add-config.png │ │ ├── dubbo-add-route.png │ │ ├── dubbo-consumers.png │ │ ├── dubbo-providers.png │ │ ├── dubbo-applications.png │ │ └── dubbo-monitor-simple.jpg ├── install │ ├── provider-demo.md │ ├── consumer-demo.md │ ├── introduction.md │ ├── admin-console.md │ ├── redis.md │ ├── simple-registry-center.md │ └── simple-monitor-center.md └── SUMMARY.md ├── dubbo-user-book ├── demos │ ├── index.md │ ├── distributed-transaction.md │ ├── lazy-connect.md │ ├── stickiness.md │ ├── introduction.md │ ├── accesslog.md │ ├── dump.md │ ├── subscribe-only.md │ ├── logger-strategy.md │ ├── registry-only.md │ ├── echo-service.md │ ├── service-group.md │ ├── graceful-shutdown.md │ ├── netty4.md │ ├── service-downgrade.md │ ├── config-connections.md │ ├── result-cache.md │ ├── static-service.md │ ├── attachment.md │ ├── local-call.md │ ├── multi-versions.md │ ├── token-authorization.md │ ├── hostname-binding.md │ ├── thread-model.md │ ├── explicit-target.md │ ├── local-stub.md │ ├── generic-service.md │ ├── local-mock.md │ ├── reference-config-cache.md │ ├── preflight-check.md │ ├── context.md │ ├── delay-publish.md │ ├── group-merger.md │ ├── loadbalance.md │ ├── service-container.md │ ├── async-call.md │ ├── concurrency-control.md │ └── config-rule.md ├── preface │ ├── index.md │ ├── background.md │ ├── requirements.md │ └── usage.md ├── configuration │ ├── index.md │ └── properties.md ├── references │ ├── registry │ │ ├── introduction.md │ │ └── multicast.md │ ├── protocol │ │ ├── introduction.md │ │ ├── thrift.md │ │ ├── http.md │ │ ├── redis.md │ │ ├── memcached.md │ │ └── hessian.md │ ├── maven.md │ ├── xml │ │ ├── introduction.md │ │ ├── dubbo-monitor.md │ │ └── dubbo-module.md │ └── api.md ├── README.md ├── sources │ └── images │ │ ├── 1kres.png │ │ ├── 1ktps.png │ │ ├── stub.jpg │ │ ├── 200kres.png │ │ ├── 200ktps.png │ │ ├── 50kres.png │ │ ├── 50ktps.png │ │ ├── cluster.jpg │ │ ├── context.png │ │ ├── future.jpg │ │ ├── jta-xa.jpg │ │ ├── pojores.png │ │ ├── pojotps.png │ │ ├── multicast.jpg │ │ ├── zookeeper.jpg │ │ ├── dubbo-config.jpg │ │ ├── dubbo-token.jpg │ │ ├── code-coverage.jpg │ │ ├── code-dependency.jpg │ │ ├── code-quality1.jpg │ │ ├── code-quality5.jpg │ │ ├── code-tendency.jpg │ │ ├── dubbo-directly.jpg │ │ ├── dubbo-protocol.jpg │ │ ├── lock-get-bean.jpg │ │ ├── subscribe-only.jpg │ │ ├── lock-init-context.jpg │ │ ├── dubbo-architecture.jpg │ │ ├── dubbo-redis-registry.jpg │ │ ├── dubbo-config-override.jpg │ │ ├── dubbo-architecture-future.jpg │ │ ├── dubbo-properties-override.jpg │ │ ├── dubbo-service-governance.jpg │ │ ├── dubbo-architecture-roadmap.jpg │ │ └── subscribe-only.jpg-version=1&modificationDate=1326468174000.jpg ├── capacity-plan.md ├── coveragence.md ├── benchmark-tool.md └── dependencies.md ├── dubbo-dev-book ├── introduction.md ├── impls │ ├── introduction.md │ ├── compiler.md │ ├── merger.md │ ├── networker.md │ ├── container.md │ ├── extension-factory.md │ ├── threadpool.md │ ├── router.md │ ├── page.md │ ├── invoker-listener.md │ ├── exporter-listener.md │ ├── proxy-factory.md │ ├── dispatcher.md │ ├── load-balance.md │ ├── validation.md │ ├── monitor.md │ ├── status-checker.md │ └── logger-adapter.md ├── principals │ ├── introduction.md │ └── expansibility.md ├── README.md ├── sources │ └── images │ │ ├── ddd.jpg │ │ ├── dubbo-refer.jpg │ │ ├── mix-api-spi.jpg │ │ ├── open-expand.jpg │ │ ├── close-expand.jpg │ │ ├── design-step1.png │ │ ├── design-step2.png │ │ ├── design-step3.png │ │ ├── design-step4.png │ │ ├── dubbo-export.jpg │ │ ├── dubbo-modules.jpg │ │ ├── filter-chain.jpg │ │ ├── dubbo-extension.jpg │ │ ├── dubbo-framework.jpg │ │ ├── dubbo-protocol.jpg │ │ ├── dubbo-relation.jpg │ │ ├── dubbo_rpc_export.jpg │ │ ├── dubbo_rpc_invoke.jpg │ │ ├── dubbo_rpc_refer.jpg │ │ ├── event-listener.jpg │ │ ├── seperate-api-spi.jpg │ │ ├── dubbo_protocol_header.jpg │ │ └── configuration-override.png ├── contract.md ├── checklist.md ├── TCK.md ├── release.md └── build.md ├── dubbo-user-book-en ├── demos │ ├── index.md │ ├── distributed-transaction.md │ ├── lazy-connect.md │ ├── stickiness.md │ ├── introduction.md │ ├── logger-strategy.md │ ├── dump.md │ ├── subscribe-only.md │ ├── service-group.md │ ├── registry-only.md │ ├── echo-service.md │ ├── netty4.md │ ├── result-cache.md │ ├── static-service.md │ ├── service-donwngrade.md │ ├── attachment.md │ ├── config-connections.md │ ├── local-call.md │ ├── graceful-shutdown.md │ ├── hostname-binding.md │ ├── multi-versions.md │ ├── token-authorization.md │ └── local-mock.md ├── preface │ ├── index.md │ └── usage.md ├── configuration │ └── index.md ├── README.md ├── sources │ └── images │ │ ├── stub.jpg │ │ ├── 1kres.png │ │ ├── 1ktps.png │ │ ├── 200kres.png │ │ ├── 200ktps.png │ │ ├── 50kres.png │ │ ├── 50ktps.png │ │ ├── cluster.jpg │ │ ├── context.png │ │ ├── future.jpg │ │ ├── jta-xa.jpg │ │ ├── pojores.png │ │ ├── pojotps.png │ │ ├── multicast.jpg │ │ ├── zookeeper.jpg │ │ ├── dubbo-config.jpg │ │ ├── dubbo-token.jpg │ │ ├── code-coverage.jpg │ │ ├── code-quality1.jpg │ │ ├── code-quality2.jpg │ │ ├── code-quality3.jpg │ │ ├── code-quality4.jpg │ │ ├── code-quality5.jpg │ │ ├── code-quality6.jpg │ │ ├── code-quality7.jpg │ │ ├── code-tendency.jpg │ │ ├── dubbo-directly.jpg │ │ ├── dubbo-protocol.jpg │ │ ├── lock-get-bean.jpg │ │ ├── subscribe-only.jpg │ │ ├── code-dependency.jpg │ │ ├── lock-init-context.jpg │ │ ├── dubbo-architecture.jpg │ │ ├── dubbo-config-override.jpg │ │ ├── dubbo-redis-registry.jpg │ │ ├── dubbo-service-governance.jpg │ │ ├── dubbo-architecture-future.jpg │ │ ├── dubbo-architecture-roadmap.jpg │ │ ├── dubbo-properties-override.jpg │ │ └── subscribe-only.jpg-version=1&modificationDate=1326468174000.jpg ├── references │ ├── registry │ │ ├── introduction.md │ │ └── multicast.md │ ├── protocol │ │ ├── introduction.md │ │ ├── thrift.md │ │ ├── redis.md │ │ ├── memcached.md │ │ └── http.md │ ├── maven.md │ └── xml │ │ └── introduction.md ├── capacity-plan.md ├── coveragence.md └── benchmark-tool.md ├── dubbo-admin-book-en ├── ops │ ├── introduction.md │ └── dubbo-ops.md ├── sources │ └── images │ │ ├── tip.png │ │ ├── check.gif │ │ ├── warning-3.gif │ │ ├── dubbo-search.png │ │ ├── dubbo-add-config.png │ │ ├── dubbo-add-route.png │ │ ├── dubbo-consumers.png │ │ ├── dubbo-providers.png │ │ ├── dubbo-applications.png │ │ └── dubbo-monitor-simple.jpg ├── README.md ├── install │ ├── consumer-demo.md │ ├── provider-demo.md │ ├── admin-console.md │ ├── redis.md │ ├── simple-registry-center.md │ └── introduction.md └── SUMMARY.md └── .gitignore /dubbo-dev-book-en/introduction.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/.gitignore: -------------------------------------------------------------------------------- 1 | _book 2 | -------------------------------------------------------------------------------- /dubbo-admin-book/ops/introduction.md: -------------------------------------------------------------------------------- 1 | # 运维手册 -------------------------------------------------------------------------------- /dubbo-user-book/demos/index.md: -------------------------------------------------------------------------------- 1 | # 示例 2 | -------------------------------------------------------------------------------- /dubbo-user-book/preface/index.md: -------------------------------------------------------------------------------- 1 | # 入门 2 | -------------------------------------------------------------------------------- /dubbo-dev-book/introduction.md: -------------------------------------------------------------------------------- 1 | 这里增加《开发指南》的内容 2 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/index.md: -------------------------------------------------------------------------------- 1 | # Example 2 | -------------------------------------------------------------------------------- /dubbo-user-book/configuration/index.md: -------------------------------------------------------------------------------- 1 | # 配置 2 | -------------------------------------------------------------------------------- /dubbo-admin-book-en/ops/introduction.md: -------------------------------------------------------------------------------- 1 | # Ops manual -------------------------------------------------------------------------------- /dubbo-user-book-en/preface/index.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | -------------------------------------------------------------------------------- /dubbo-admin-book/README.md: -------------------------------------------------------------------------------- 1 | 这篇文档详细讲解了 dubbo 注册中心、管理控制台的安装和使用。 -------------------------------------------------------------------------------- /dubbo-user-book-en/configuration/index.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/introduction.md: -------------------------------------------------------------------------------- 1 | # SPI 扩展实现 2 | 3 | SPI 扩展接口仅用于系统集成,或 Contributor 扩展功能插件。 -------------------------------------------------------------------------------- /dubbo-dev-book/principals/introduction.md: -------------------------------------------------------------------------------- 1 | # 设计原则 2 | 3 | 本章节的设计原则摘录自梁飞在 javaeye 上发表的系列文章。 -------------------------------------------------------------------------------- /dubbo-user-book/references/registry/introduction.md: -------------------------------------------------------------------------------- 1 | ## 注册中心参考手册 2 | 3 | 推荐使用 [Zookeeper 注册中心](./zookeeper.md) -------------------------------------------------------------------------------- /dubbo-dev-book/README.md: -------------------------------------------------------------------------------- 1 | 这篇文档的目标读者是对 dubbo 源码、设计有兴趣的,或者有意愿加入 dubbo 开发的人群。主要涵盖了 dubbo 的框架设计、扩展机制、编码规范、版本管理、构建等话题。 2 | -------------------------------------------------------------------------------- /dubbo-user-book/README.md: -------------------------------------------------------------------------------- 1 | 这篇文档详细讲解了`dubbo`的使用,基本涵盖`dubbo`的所有功能特性。 2 | 3 | 如果你正依赖`dubbo`作为你业务工程的RPC通信框架,这里可以作为你的参考手册 4 | -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/ddd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/ddd.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/README.md: -------------------------------------------------------------------------------- 1 | # dubbo-user-book 2 | The dubbo cookbook, covering almost all features of dubbo framework. 3 | 4 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/ddd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/ddd.jpg -------------------------------------------------------------------------------- /dubbo-user-book/references/protocol/introduction.md: -------------------------------------------------------------------------------- 1 | # 协议参考手册 2 | 3 | 推荐使用 Dubbo 协议。各协议的性能情况,请参见:[性能测试报告](../../perf-test.md) 4 | -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/1kres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/1kres.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/1ktps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/1ktps.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/stub.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/stub.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/tip.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/stub.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/stub.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/200kres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/200kres.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/200ktps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/200ktps.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/50kres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/50kres.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/50ktps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/50ktps.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/cluster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/cluster.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/context.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/future.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/future.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/jta-xa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/jta-xa.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/pojores.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/pojores.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/pojotps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/pojotps.png -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/check.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/check.gif -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-refer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-refer.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/mix-api-spi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/mix-api-spi.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/open-expand.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/open-expand.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/1kres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/1kres.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/1ktps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/1ktps.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/200kres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/200kres.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/200ktps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/200ktps.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/50kres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/50kres.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/50ktps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/50ktps.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/cluster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/cluster.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/context.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/future.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/future.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/jta-xa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/jta-xa.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/pojores.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/pojores.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/pojotps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/pojotps.png -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/multicast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/multicast.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/zookeeper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/zookeeper.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/README.md: -------------------------------------------------------------------------------- 1 | # dubbo-admin-book 2 | The installation and maintenance guidance of registry center and dubbo-admin. 3 | 4 | 5 | -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/close-expand.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/close-expand.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/design-step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/design-step1.png -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/design-step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/design-step2.png -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/design-step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/design-step3.png -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/design-step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/design-step4.png -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-export.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-export.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-modules.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-modules.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/filter-chain.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/filter-chain.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/multicast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/multicast.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/zookeeper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/zookeeper.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-config.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-config.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-token.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-token.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/warning-3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/warning-3.gif -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-search.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/close-expand.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/close-expand.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/design-step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/design-step1.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/design-step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/design-step2.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/design-step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/design-step3.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/design-step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/design-step4.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-export.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-export.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-modules.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-modules.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-refer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-refer.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/filter-chain.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/filter-chain.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/mix-api-spi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/mix-api-spi.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/open-expand.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/open-expand.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-extension.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-extension.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-framework.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-framework.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-protocol.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-protocol.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo-relation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo-relation.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo_rpc_export.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo_rpc_export.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo_rpc_invoke.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo_rpc_invoke.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo_rpc_refer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo_rpc_refer.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/event-listener.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/event-listener.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/seperate-api-spi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/seperate-api-spi.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-config.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-config.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-token.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-token.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/code-coverage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/code-coverage.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/code-dependency.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/code-dependency.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/code-quality1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/code-quality1.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/code-quality5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/code-quality5.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/code-tendency.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/code-tendency.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-directly.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-directly.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-protocol.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-protocol.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/lock-get-bean.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/lock-get-bean.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/subscribe-only.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/subscribe-only.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-search.png -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-add-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-add-config.png -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-add-route.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-add-route.png -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-consumers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-consumers.png -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-providers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-providers.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-extension.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-extension.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-framework.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-framework.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-protocol.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-protocol.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo-relation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo-relation.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo_rpc_refer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo_rpc_refer.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/event-listener.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/event-listener.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-coverage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-coverage.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality1.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality2.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality3.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality4.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality5.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality6.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-quality7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-quality7.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-tendency.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-tendency.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-directly.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-directly.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-protocol.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-protocol.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/lock-get-bean.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/lock-get-bean.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/subscribe-only.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/subscribe-only.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/lock-init-context.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/lock-init-context.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-add-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-add-config.png -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-add-route.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-add-route.png -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-consumers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-consumers.png -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-providers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-providers.png -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-applications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-applications.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo_rpc_export.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo_rpc_export.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo_rpc_invoke.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo_rpc_invoke.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/seperate-api-spi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/seperate-api-spi.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/dubbo_protocol_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/dubbo_protocol_header.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/references/registry/introduction.md: -------------------------------------------------------------------------------- 1 | ## Registry Server References 2 | 3 | It is recommended to use [zookeeper registry server](./zookeeper.md) -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/code-dependency.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/code-dependency.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/lock-init-context.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/lock-init-context.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-architecture.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-redis-registry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-redis-registry.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-applications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-applications.png -------------------------------------------------------------------------------- /dubbo-admin-book/sources/images/dubbo-monitor-simple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book/sources/images/dubbo-monitor-simple.jpg -------------------------------------------------------------------------------- /dubbo-dev-book/sources/images/configuration-override.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book/sources/images/configuration-override.png -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-architecture.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-config-override.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-config-override.jpg -------------------------------------------------------------------------------- /dubbo-admin-book-en/sources/images/dubbo-monitor-simple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-admin-book-en/sources/images/dubbo-monitor-simple.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/configuration-override.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/configuration-override.png -------------------------------------------------------------------------------- /dubbo-dev-book-en/sources/images/dubbo_protocol_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-dev-book-en/sources/images/dubbo_protocol_header.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-config-override.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-config-override.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-redis-registry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-redis-registry.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-architecture-future.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-architecture-future.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-properties-override.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-properties-override.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-service-governance.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-service-governance.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-service-governance.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-service-governance.jpg -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/dubbo-architecture-roadmap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/dubbo-architecture-roadmap.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-architecture-future.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-architecture-future.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-architecture-roadmap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-architecture-roadmap.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/dubbo-properties-override.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/dubbo-properties-override.jpg -------------------------------------------------------------------------------- /dubbo-dev-book-en/README.md: -------------------------------------------------------------------------------- 1 | # dubbo-dev-book 2 | This book dives into the design principles of dubbo, mainly covers the following topics: extension, coding styles, versio, build, etc. 3 | 4 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/distributed-transaction.md: -------------------------------------------------------------------------------- 1 | # 分布式事务 2 | 3 | 分布式事务基于 JTA/XA 规范实现 [^1]。 4 | 5 | 两阶段提交: 6 | 7 | ![/user-guide/images/jta-xa.jpg](../sources/images/jta-xa.jpg) 8 | 9 | [^1]: 本功能暂未实现 -------------------------------------------------------------------------------- /dubbo-user-book-en/references/protocol/introduction.md: -------------------------------------------------------------------------------- 1 | # Protocol reference Book 2 | 3 | Dubbo protocol is recommended. The performance of each protocol, see:[Performance](../../perf-test.md) 4 | 5 | 6 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/introduction.md: -------------------------------------------------------------------------------- 1 | # SPI Extension Implementations 2 | 3 | SPI extension interface is used for system integration, it's also useful for dubbo contributor to extend dubbo functionality. 4 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/lazy-connect.md: -------------------------------------------------------------------------------- 1 | # 延迟连接 2 | 3 | 延迟连接用于减少长连接数。当有调用发起时,再创建长连接。[^1] 4 | 5 | ```xml 6 | 7 | ``` 8 | 9 | [^1]: 注意:该配置只对使用长连接的 dubbo 协议生效。 10 | -------------------------------------------------------------------------------- /dubbo-user-book/sources/images/subscribe-only.jpg-version=1&modificationDate=1326468174000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book/sources/images/subscribe-only.jpg-version=1&modificationDate=1326468174000.jpg -------------------------------------------------------------------------------- /dubbo-user-book-en/sources/images/subscribe-only.jpg-version=1&modificationDate=1326468174000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-docs/HEAD/dubbo-user-book-en/sources/images/subscribe-only.jpg-version=1&modificationDate=1326468174000.jpg -------------------------------------------------------------------------------- /dubbo-user-book/demos/stickiness.md: -------------------------------------------------------------------------------- 1 | # 粘滞连接 2 | 3 | 粘滞连接用于有状态服务,尽可能让客户端总是向同一提供者发起调用,除非该提供者挂了,再连另一台。 4 | 5 | 粘滞连接将自动开启[延迟连接](./lazy-connect.md),以减少长连接数。 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/introduction.md: -------------------------------------------------------------------------------- 1 | > ![warning](../sources/images/check.gif)想完整的运行起来,请参见:[快速启动](quickstart.md),这里只列出各种场景的配置方式。 2 | > ![warning](../sources/images/check.gif)以下示例全部使用基于Spring的[Xml配置](../configuration/xml.md)作为参考,如果不想使用Spring,而希望通过API的方式进行调用,请参见:[API配置](../configuration/api.md) -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/distributed-transaction.md: -------------------------------------------------------------------------------- 1 | # Distributed transaction 2 | 3 | Distributed transactions are based on the JTA / XA specification(this feature has not yet been implemented) 4 | 5 | Two-phase commit: 6 | 7 | ![/user-guide/images/jta-xa.jpg](../sources/images/jta-xa.jpg) 8 | -------------------------------------------------------------------------------- /dubbo-dev-book/contract.md: -------------------------------------------------------------------------------- 1 | # 公共契约 2 | 3 | 这里记录的是 Dubbo 公共契约,希望所有扩展点遵守。 4 | 5 | ## URL 6 | 7 | * 所有扩展点参数都包含 URL 参数,URL 作为上下文信息贯穿整个扩展点设计体系。 8 | * URL 采用标准格式:`protocol://username:password@host:port/path?key=value&key=value` 9 | 10 | ## 日志 11 | 12 | * 如果不可恢复或需要报警,打印 ERROR 日志。 13 | * 如果可恢复异常,或瞬时的状态不一致,打印 WARN 日志。 14 | * 正常运行时的中间状态提示,打印 INFO 日志。 -------------------------------------------------------------------------------- /dubbo-user-book/demos/accesslog.md: -------------------------------------------------------------------------------- 1 | # 访问日志 2 | 3 | 如果你想记录每一次请求信息,可开启访问日志,类似于apache的访问日志。**注意**:此日志量比较大,请注意磁盘容量。 4 | 5 | 将访问日志输出到当前应用的log4j日志: 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | 将访问日志输出到指定文件: 12 | 13 | ```xml 14 | 15 | ``` 16 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/lazy-connect.md: -------------------------------------------------------------------------------- 1 | # Lazy Connect 2 | 3 | Lazy connect can reduce the number of keep-alive connections. When a call is initiated, create a keep-alive connection.[^1] 4 | 5 | ```xml 6 | 7 | ``` 8 | 9 | [^1]: Note: This configuration takes effect only for dubbo protocols that use keep-alive connections. 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # maven ignore 2 | target/ 3 | *.jar 4 | *.war 5 | *.zip 6 | *.tar 7 | *.tar.gz 8 | 9 | # eclipse ignore 10 | .settings/ 11 | .project 12 | .classpath 13 | 14 | # idea ignore 15 | .idea/ 16 | *.ipr 17 | *.iml 18 | *.iws 19 | 20 | # temp ignore 21 | *.log 22 | *.cache 23 | *.diff 24 | *.patch 25 | *.tmp 26 | */_book/ 27 | 28 | # system ignore 29 | .DS_Store 30 | Thumbs.db 31 | 32 | -------------------------------------------------------------------------------- /dubbo-user-book/references/maven.md: -------------------------------------------------------------------------------- 1 | # Maven 插件参考手册 2 | 3 | ## 启动一个简易注册中心 4 | 5 | 以指定的9099端口启动一个简易注册中心 [^1]: 6 | 7 | ```sh 8 | mvn dubbo:registry -Dport=9099 9 | ``` 10 | 11 | ## 生成demo服务提供者应用 12 | 13 | 生成指定接口和版本的服务提供者应用: 14 | 15 | ```sh 16 | mvn dubbo:create -Dapplication=xxx -Dpackage=com.alibaba.xxx -Dservice=XxxService,YyyService -Dversion=1.0.0 17 | ``` 18 | 19 | [^1]: 如果端口不指定,默认端口为 9090 20 | -------------------------------------------------------------------------------- /dubbo-user-book/capacity-plan.md: -------------------------------------------------------------------------------- 1 | # 容量规划 2 | 3 | 以下数据供参考: 4 | 5 | ## 使用 Dubbo 的会员服务项目 6 | 7 | * 每天接收 4 亿次远程调用 8 | * 使用 12 台网站标配机器提供服务(8 核 CPU, 8G 内存) 9 | * 平均负载在 1 以下(对于 8 核 CPU 负载很低) 10 | * 平均响应时间 2.3 到 2.5 毫秒,网络开销约占 1.5 到 1.6 毫秒(和数据包大小有关) 11 | 12 | ## 使用 Dubbo 的产品授权服务项目 13 | 14 | * 每天接收 3 亿次远程调用 15 | * 使用 8 台网站标配机器提供服务(8 核CPU,8G 内存) 16 | * 平均负载在 1 以下(对于 8 核 CPU 负载很低) 17 | * 平均响应时间 1.4 到 2.8 毫秒,网络开销约占 1.0 到 1.1 毫秒(和数据包大小有关) -------------------------------------------------------------------------------- /dubbo-user-book/demos/dump.md: -------------------------------------------------------------------------------- 1 | 当业务线程池满时,我们需要知道线程都在等待哪些资源、条件,以找到系统的瓶颈点或异常点。dubbo通过Jstack自动导出线程堆栈来保留现场,方便排查问题 2 | 3 | 默认策略: 4 | 5 | * 导出路径,user.home标识的用户主目录 6 | * 导出间隔,最短间隔允许每隔10分钟导出一次 7 | 8 | 指定导出路径: 9 | ```properties 10 | # dubbo.properties 11 | dubbo.application.dump.directory=/tmp 12 | ``` 13 | 14 | ```xml 15 | 16 | 17 | 18 | ``` -------------------------------------------------------------------------------- /dubbo-admin-book/install/provider-demo.md: -------------------------------------------------------------------------------- 1 | # 示例提供者安装 2 | 3 | 安装: 4 | 5 | ```sh 6 | git clone https://github.com/apache/incubator-dubbo.git 7 | cd incubator-dubbo 8 | 运行 dubbo-demo-provider中的com.alibaba.dubbo.demo.provider.Provider 9 | 如果使用Intellij Idea 请加上-Djava.net.preferIPv4Stack=true 10 | ``` 11 | 12 | 配置: 13 | 14 | ```sh 15 | resource/META-INFO.spring/dubbo-demo-provider.xml 16 | 修改其中的dubbo:registery,替换成真实的注册中心地址,推荐使用zookeeper 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/stickiness.md: -------------------------------------------------------------------------------- 1 | # stickiness 2 | 3 | Sticky connections are used for stateful services, as much as possible so that clients always make calls to the same provider, unless the provider hangs up and connects to the other one. 4 | 5 | Sticky connections will automatically open [Delayed Connections](./lazy-connect.md) to reduce the number of long connections. 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /dubbo-admin-book-en/install/consumer-demo.md: -------------------------------------------------------------------------------- 1 | 2 | # install demo consumer 3 | 4 | install: 5 | 6 | ```sh 7 | git clone https://github.com/apache/incubator-dubbo.git 8 | cd incubator-dubbo 9 | Please start Provider first 10 | add -Djava.net.preferIPv4Stack=true if your IDE is Intellij Idea 11 | ``` 12 | 13 | configuration: 14 | 15 | ```sh 16 | resource/META-INFO.spring/dubbo-demo-consumer.xml 17 | change dubbo:registery to the real registery center address 18 | ``` 19 | -------------------------------------------------------------------------------- /dubbo-admin-book/install/consumer-demo.md: -------------------------------------------------------------------------------- 1 | 2 | # 示例消费者安装 3 | 4 | 安装: 5 | 6 | ```sh 7 | git clone https://github.com/apache/incubator-dubbo.git 8 | cd incubator-dubbo 9 | 运行 dubbo-demo-consumer中的com.alibaba.dubbo.demo.consumer.Consumer 10 | 请确保先启动Provider 11 | 如果使用Intellij Idea 请加上-Djava.net.preferIPv4Stack=true 12 | ``` 13 | 14 | 配置: 15 | 16 | ```sh 17 | resource/META-INFO.spring/dubbo-demo-consumer.xml 18 | 修改其中的dubbo:registery,替换成Provider提供的注册中心地址 19 | ``` 20 | 21 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/introduction.md: -------------------------------------------------------------------------------- 1 | > ![warning](../sources/images/check.gif)To complete run, please see:[Quickstart](quickstart.md), here just lists the configuration of various scenarios 2 | > ![warning](../sources/images/check.gif)The following examples are all based on Spring configuration:[Xml configuration](../configuration/xml.md) for reference, if you do not want to use Spring, but want to be use it via the directly API, please see:[API configuration](../configuration/api.md) 3 | -------------------------------------------------------------------------------- /dubbo-user-book/coveragence.md: -------------------------------------------------------------------------------- 1 | # 测试覆盖率报告 2 | 3 | 基于 `2.0.12` 版本,统计于 2012-02-03 4 | 5 | ![/sources/images/code-quality1.jpg](sources/images/code-quality1.jpg) 6 | 7 | 8 | ![/sources/images/code-quality5.jpg](sources/images/code-quality5.jpg) 9 | 10 | ![/sources/images/code-coverage.jpg](sources/images/code-coverage.jpg) 11 | 12 | ![/sources/images/code-tendency.jpg](sources/images/code-tendency.jpg) 13 | 14 | ![/sources/images/code-dependency.jpg](sources/images/code-dependency.jpg) -------------------------------------------------------------------------------- /dubbo-user-book/demos/subscribe-only.md: -------------------------------------------------------------------------------- 1 | # 只订阅 2 | 3 | 为方便开发测试,经常会在线下共用一个所有服务可用的注册中心,这时,如果一个正在开发中的服务提供者注册,可能会影响消费者不能正常运行。 4 | 5 | 可以让服务提供者开发方,只订阅服务(开发的服务可能依赖其它服务),而不注册正在开发的服务,通过直连测试正在开发的服务。 6 | 7 | ![/user-guide/images/subscribe-only.jpg](../sources/images/subscribe-only.jpg) 8 | 9 | 禁用注册配置 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | 或者 16 | 17 | ```xml 18 | 19 | ``` 20 | -------------------------------------------------------------------------------- /dubbo-admin-book/SUMMARY.md: -------------------------------------------------------------------------------- 1 | * [1 安装手册](install/introduction.md) 2 | * [1.1 示例提供者安装](install/provider-demo.md) 3 | * [1.2 示例消费者安装](install/consumer-demo.md) 4 | * [1.3 Zookeeper 注册中心安装](install/zookeeper.md) 5 | * [1.4 Redis 注册中心安装](install/redis.md) 6 | * [1.5 Simple 注册中心安装](install/simple-registry-center.md) 7 | * [1.6 Simple 监控中心安装](install/simple-monitor-center.md) 8 | * [1.7 管理控制台安装](install/admin-console.md) 9 | * [2 运维手册](ops/introduction.md) 10 | * [2.1 管理控制台运维](ops/dubbo-ops.md) 11 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/checklist.md: -------------------------------------------------------------------------------- 1 | # Checklist 2 | 3 | ## Checklist before release 4 | 5 | * github milestones 6 | * github change lists 7 | * Travis CI 8 | * test code 9 | * find bugs 10 | 11 | ## Checklist for bigfix versions 12 | 13 | * Create a _github issue_ before coding 14 | * Create _unit test_ before bugfix 15 | * Review 16 | * Test your code (Normal process / Abnormal process) 17 | * Record your design on _github issue_ 18 | * Complete javadoc and comment in code 19 | * Manager for every version, responsible for scope and check -------------------------------------------------------------------------------- /dubbo-user-book/demos/logger-strategy.md: -------------------------------------------------------------------------------- 1 | # 日志适配 2 | 3 | 自 `2.2.1` 开始,dubbo 开始内置 log4j、slf4j、jcl、jdk 这些日志框架的适配 [^1],也可以通过以下方式显示配置日志输出策略: 4 | 5 | 0. 命令行 6 | 7 | ```sh 8 | java -Ddubbo.application.logger=log4j 9 | ``` 10 | 11 | 0. 在 `dubbo.properties` 中指定 12 | 13 | ``` 14 | dubbo.application.logger=log4j 15 | ``` 16 | 17 | 0. 在 `dubbo.xml` 中配置 18 | 19 | ```xml 20 | 21 | ``` 22 | 23 | [^1]: 自定义扩展可以参考[日志适配扩展](http://dubbo.apache.org/books/dubbo-dev-book/impls/logger-adapter.html) 24 | -------------------------------------------------------------------------------- /dubbo-admin-book-en/install/provider-demo.md: -------------------------------------------------------------------------------- 1 | # install demo provider 2 | 3 | install: 4 | 5 | ```sh 6 | git clone https://github.com/apache/incubator-dubbo.git 7 | cd incubator-dubbo 8 | run com.alibaba.dubbo.demo.provider.Provider under dubbo-demo-provider module 9 | add -Djava.net.preferIPv4Stack=true if your IDE is Intellij Idea 10 | ``` 11 | 12 | configuration: 13 | 14 | ```sh 15 | resource/META-INFO.spring/dubbo-demo-provider.xml 16 | change dubbo:registery to a real registery server address, zookeeper is recommanded 17 | ``` 18 | -------------------------------------------------------------------------------- /dubbo-dev-book/checklist.md: -------------------------------------------------------------------------------- 1 | # 检查列表 2 | 3 | ## 发布前 checklist 4 | 5 | * jira ticket 过一遍 6 | * svn change list 7 | * ticket 关联 code 8 | * test code 9 | * find bugs 10 | 11 | ## 修复时 checklist 12 | 13 | * 修复代码前先建 ticket 14 | * 修复代码前先写测试用例 15 | * 需要伙伴检查 16 | * test code(正常流程/异常流程) 17 | * 讲一遍逻辑 18 | * 契约文档化 19 | * 以上内容都写到ticket的评论上 20 | * 代码注释写清楚,用中文无妨 21 | * 每个版本要有 owner,确保 scope 和 check 22 | 23 | ## Partner Check 24 | 25 | * Partner 以用户的方式运行一下功能 26 | * Partner 发现问题、添加测试(集成测试)复现总是;Owner 完成实现。(保证两方的时间投入 PatternerCheck 的给予时间保证) 27 | * Owner 向 Partner 讲述一遍实现。 -------------------------------------------------------------------------------- /dubbo-user-book/demos/registry-only.md: -------------------------------------------------------------------------------- 1 | # 只注册 2 | 3 | 如果有两个镜像环境,两个注册中心,有一个服务只在其中一个注册中心有部署,另一个注册中心还没来得及部署,而两个注册中心的其它应用都需要依赖此服务。这个时候,可以让服务提供者方只注册服务到另一注册中心,而不从另一注册中心订阅服务。 4 | 5 | 禁用订阅配置 6 | 7 | ```xml 8 | 9 | 10 | ``` 11 | 12 | 或者 13 | 14 | ```xml 15 | 16 | 17 | ``` 18 | -------------------------------------------------------------------------------- /dubbo-user-book-en/references/maven.md: -------------------------------------------------------------------------------- 1 | # Maven Plugin Reference 2 | 3 | ## Start a simple registry server 4 | 5 | Start a simple registry server listening on port 9099 [^1]: 6 | 7 | ```sh 8 | mvn dubbo:registry -Dport=9099 9 | ``` 10 | 11 | ## Generate a service provider demo application 12 | 13 | Generate a service provider with the specified interface and version: 14 | 15 | ```sh 16 | mvn dubbo:create -Dapplication=xxx -Dpackage=com.alibaba.xxx -Dservice=XxxService,YyyService -Dversion=1.0.0 17 | ``` 18 | 19 | [^1]: Default port is 9090 if the port is not specified -------------------------------------------------------------------------------- /dubbo-user-book/demos/echo-service.md: -------------------------------------------------------------------------------- 1 | # 回声测试 2 | 3 | 回声测试用于检测服务是否可用,回声测试按照正常请求流程执行,能够测试整个调用是否通畅,可用于监控。 4 | 5 | 所有服务自动实现 `EchoService` 接口,只需将任意服务引用强制转型为 `EchoService`,即可使用。 6 | 7 | Spring 配置: 8 | 9 | ```xml 10 | 11 | ``` 12 | 13 | 代码: 14 | 15 | ```java 16 | // 远程服务引用 17 | MemberService memberService = ctx.getBean("memberService"); 18 | 19 | EchoService echoService = (EchoService) memberService; // 强制转型为EchoService 20 | 21 | // 回声测试可用性 22 | String status = echoService.$echo("OK"); 23 | 24 | assert(status.equals("OK")); 25 | ``` 26 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/contract.md: -------------------------------------------------------------------------------- 1 | # Public Agreement 2 | 3 | This document is Dubbo public agreement, we expect all extension points comply with it. 4 | 5 | ## URL 6 | 7 | * All extension points must include URL parameter, design URL as a context information which throughouts the whole extension point design system. 8 | * URL standard style: `protocol://username:password@host:port/path?key=value&key=value` 9 | 10 | ## Logging 11 | 12 | * Print `ERROR` log for unrecoverable and NEED TO ALARM situation. 13 | * Print `WARN` log for recoverable exception or transient state inconsistency. 14 | * Print `INFO` log for normally status. -------------------------------------------------------------------------------- /dubbo-dev-book/TCK.md: -------------------------------------------------------------------------------- 1 | # 技术兼容性测试 2 | 3 | Dubbo 的协议,通讯,序列化,注册中心,负载均策等扩展点,都有多种可选策略,以应对不同应用场景,而我们的测试用例很分散,当用户自己需要加一种新的实现时,总是不确定能否满足扩展点的完整契约。 4 | 5 | 所以,我们需要对核心扩展点写 [TCK](http://en.wikipedia.org/wiki/Technology_Compatibility_Kit) (Technology Compatibility Kit),用户增加一种扩展实现,只需通过 TCK,即可确保与框架的其它部分兼容运行,可以有效提高整体健状性,也方便第三方扩展者接入,加速开源社区的成熟。 6 | 7 | 开源社区的行知同学已着手研究这一块,他的初步想法是借鉴 JBoss 的 CDI-TCK,做一个 Dubbo 的 TCK 基础框架,在此之上实现 Dubbo 的扩展点 TCK 用例。 8 | 9 | 参见:http://docs.jboss.org/cdi/tck/reference/1.0.1-Final/html/introduction.html 10 | 11 | 如果大家有兴趣,也可以一起研究,和行知一块讨论。 12 | 13 | #### Protocol TCK 14 | 15 | > TODO 16 | 17 | #### Registry TCK 18 | 19 | > TODO -------------------------------------------------------------------------------- /dubbo-admin-book-en/SUMMARY.md: -------------------------------------------------------------------------------- 1 | * [1 install manual](install/introduction.md) 2 | * [1.1 install provider demo](install/provider-demo.md) 3 | * [1.2 install consumer demo](install/consumer-demo.md) 4 | * [1.3 install Zookeeper configuration center](install/zookeeper.md) 5 | * [1.4 install Redis configuration center](install/redis.md) 6 | * [1.5 install Simple configuration center](install/simple-registry-center.md) 7 | * [1.6 install Simple monitor center](install/simple-monitor-center.md) 8 | * [1.7 install admin console](install/admin-console.md) 9 | * [2 Ops manual]() 10 | * [2.1 admin-console Ops](ops/dubbo-ops.md) 11 | -------------------------------------------------------------------------------- /dubbo-user-book/preface/background.md: -------------------------------------------------------------------------------- 1 | # 背景 2 | 3 | 随着互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,亟需一个治理系统确保架构有条不紊的演进。 4 | 5 | ![image](../sources/images/dubbo-architecture-roadmap.jpg) 6 | 7 | #### 单一应用架构 8 | 当网站流量很小时,只需一个应用,将所有功能都部署在一起,以减少部署节点和成本。此时,用于简化增删改查工作量的数据访问框架(ORM)是关键。 9 | 10 | #### 垂直应用架构 11 | 12 | 当访问量逐渐增大,单一应用增加机器带来的加速度越来越小,将应用拆成互不相干的几个应用,以提升效率。此时,用于加速前端页面开发的Web框架(MVC)是关键。 13 | 14 | #### 分布式服务架构 15 | 16 | 当垂直应用越来越多,应用之间交互不可避免,将核心业务抽取出来,作为独立的服务,逐渐形成稳定的服务中心,使前端应用能更快速的响应多变的市场需求。此时,用于提高业务复用及整合的分布式服务框架(RPC)是关键。 17 | 18 | #### 流动计算架构 19 | 20 | 当服务越来越多,容量的评估,小服务资源的浪费等问题逐渐显现,此时需增加一个调度中心基于访问压力实时管理集群容量,提高集群利用率。此时,用于提高机器利用率的资源调度和治理中心(SOA)是关键。 -------------------------------------------------------------------------------- /dubbo-user-book/demos/service-group.md: -------------------------------------------------------------------------------- 1 | # 服务分组 2 | 3 | 当一个接口有多种实现时,可以用 group 区分。 4 | 5 | ## 服务 6 | 7 | ```xml 8 | 9 | 10 | ``` 11 | 12 | ## 引用 13 | 14 | ```xml 15 | 16 | 17 | ``` 18 | 19 | 任意组 [^1]: 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | [^1]: `2.2.0` 以上版本支持,总是只调一个可用组的实现 26 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/logger-strategy.md: -------------------------------------------------------------------------------- 1 | # Logger adapter 2 | 3 | `2.2.1` or later, dubbo support log4j、slf4j、jcl、jdk adapters [^1], you can also explicitly configure the log output policy in the following ways: 4 | 5 | 0. Command 6 | 7 | ```sh 8 | java -Ddubbo.application.logger=log4j 9 | ``` 10 | 11 | 0. Configure in `dubbo.properties` 12 | 13 | ```properties 14 | dubbo.application.logger=log4j 15 | ``` 16 | 17 | 0. Configure in `dubbo.xml` 18 | 19 | ```xml 20 | 21 | ``` 22 | 23 | [^1]: Custom Extensions[logger-adapter](http://dubbo.apache.org/books/dubbo-dev-book-en/impls/logger-adapter.html) 24 | -------------------------------------------------------------------------------- /dubbo-user-book/preface/requirements.md: -------------------------------------------------------------------------------- 1 | # 需求 2 | 3 | ![image](../sources/images/dubbo-service-governance.jpg) 4 | 5 | 在大规模服务化之前,应用可能只是通过 RMI 或 Hessian 等工具,简单的暴露和引用远程服务,通过配置服务的URL地址进行调用,通过 F5 等硬件进行负载均衡。 6 | 7 | **当服务越来越多时,服务 URL 配置管理变得非常困难,F5 硬件负载均衡器的单点压力也越来越大。** 此时需要一个服务注册中心,动态的注册和发现服务,使服务的位置透明。并通过在消费方获取服务提供方地址列表,实现软负载均衡和 Failover,降低对 F5 硬件负载均衡器的依赖,也能减少部分成本。 8 | 9 | **当进一步发展,服务间依赖关系变得错踪复杂,甚至分不清哪个应用要在哪个应用之前启动,架构师都不能完整的描述应用的架构关系。** 这时,需要自动画出应用间的依赖关系图,以帮助架构师理清理关系。 10 | 11 | **接着,服务的调用量越来越大,服务的容量问题就暴露出来,这个服务需要多少机器支撑?什么时候该加机器?** 为了解决这些问题,第一步,要将服务现在每天的调用量,响应时间,都统计出来,作为容量规划的参考指标。其次,要可以动态调整权重,在线上,将某台机器的权重一直加大,并在加大的过程中记录响应时间的变化,直到响应时间到达阀值,记录此时的访问量,再以此访问量乘以机器数反推总容量。 12 | 13 | 以上是 Dubbo 最基本的几个需求。 -------------------------------------------------------------------------------- /dubbo-user-book/demos/graceful-shutdown.md: -------------------------------------------------------------------------------- 1 | # 优雅停机 2 | 3 | Dubbo 是通过 JDK 的 ShutdownHook 来完成优雅停机的,所以如果用户使用 `kill -9 PID` 等强制关闭指令,是不会执行优雅停机的,只有通过 `kill PID` 时,才会执行。 4 | 5 | ## 原理 6 | 7 | ### 服务提供方 8 | 9 | * 停止时,先标记为不接收新请求,新请求过来时直接报错,让客户端重试其它机器。 10 | * 然后,检测线程池中的线程是否正在运行,如果有,等待所有线程执行完成,除非超时,则强制关闭。 11 | 12 | ### 服务消费方 13 | 14 | * 停止时,不再发起新的调用请求,所有新的调用在客户端即报错。 15 | * 然后,检测有没有请求的响应还没有返回,等待响应返回,除非超时,则强制关闭。 16 | 17 | ## 设置方式 18 | 19 | 设置优雅停机超时时间,缺省超时时间是 10 秒,如果超时则强制关闭。 20 | 21 | ```properties 22 | # dubbo.properties 23 | dubbo.service.shutdown.wait=15000 24 | ``` 25 | 26 | 如果 ShutdownHook 不能生效,可以自行调用,**使用tomcat等容器部署的場景,建议通过扩展ContextListener等自行调用以下代码实现优雅停机**: 27 | 28 | ```java 29 | ProtocolConfig.destroyAll(); 30 | ``` -------------------------------------------------------------------------------- /dubbo-user-book/demos/netty4.md: -------------------------------------------------------------------------------- 1 | dubbo 2.5.6版本新增了对netty4通信模块的支持,启用方式如下 2 | 3 | provider端: 4 | ```xml 5 | 6 | ``` 7 | 8 | 或 9 | 10 | ```xml 11 | 12 | ``` 13 | 14 | consumer端: 15 | ```xml 16 | 17 | 18 | ``` 19 | 20 | > **注意** 21 | > 1. provider端如需不同的协议使用不同的通信层框架,请配置多个protocol分别设置 22 | > 2. consumer端请使用如下形式: 23 | > ```xml 24 | > 25 | > 26 | > 27 | > ``` 28 | > ```xml 29 | > 30 | > 31 | > 32 | > ``` 33 | 34 | > 接下来我们会继续完善: 35 | > 1. 性能测试指标及与netty3版本的性能测试对比,我们会提供一份参考数据 -------------------------------------------------------------------------------- /dubbo-user-book/references/xml/introduction.md: -------------------------------------------------------------------------------- 1 | # schema 配置参考手册 2 | 3 | 这里以 XML Config [^1] 为准,列举所有配置项 [^2]。其它配置方式,请参见相应转换关系:[属性配置](../../configuration/properties.md),[注解配置](../../configuration/annotation.md),[API 配置](../../configuration/api.md)。 4 | 5 | 所有配置项分为三大类,参见下表中的"作用" 一列。 6 | 7 | * 服务发现:表示该配置项用于服务的注册与发现,目的是让消费方找到提供方。 8 | * 服务治理:表示该配置项用于治理服务间的关系,或为开发测试提供便利条件。 9 | * 性能调优:表示该配置项用于调优性能,不同的选项对性能会产生影响。 10 | * 所有配置最终都将转换为 URL [^3] 表示,并由服务提供方生成,经注册中心传递给消费方,各属性对应 URL 的参数,参见配置项一览表中的 "对应URL参数" 列。 11 | 12 | 13 | [^1]: XML Schema: http://dubbo.apache.org/schema/dubbo/dubbo.xsd 14 | [^2]: 注意:只有 group,interface,version 是服务的匹配条件,三者决定是不是同一个服务,其它配置项均为调优和治理参数。 15 | [^3]: URL 格式:`protocol://username:password@host:port/path?key=value&key=value` 16 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/dump.md: -------------------------------------------------------------------------------- 1 | # Dump 2 | When the business thread pool is full, we need to know what resources/conditions are waiting for the thread , to find the bottleneck point of the system or abnormal point. `dubbo` automatically export thread stack through `Jstack` to keep the scene for easy to troubleshoot the problem. 3 | 4 | Default policy: 5 | 6 | * Export file path,user.home directory 7 | * Export interval,The shortest interval allows you to export every 10 minutes 8 | 9 | Specified export file path: 10 | ```properties 11 | # dubbo.properties 12 | dubbo.application.dump.directory=/tmp 13 | ``` 14 | 15 | ```xml 16 | 17 | 18 | 19 | ``` 20 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/service-downgrade.md: -------------------------------------------------------------------------------- 1 | # 服务降级 2 | 3 | 可以通过服务降级功能 [^1] 临时屏蔽某个出错的非关键服务,并定义降级后的返回策略。 4 | 5 | 向注册中心写入动态配置覆盖规则: 6 | 7 | ```java 8 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 9 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 10 | registry.register(URL.valueOf("override://0.0.0.0/com.foo.BarService?category=configurators&dynamic=false&application=foo&mock=force:return+null")); 11 | ``` 12 | 13 | 其中: 14 | 15 | * `mock=force:return+null` 表示消费方对该服务的方法调用都直接返回 null 值,不发起远程调用。用来屏蔽不重要服务不可用时对调用方的影响。 16 | * 还可以改为 `mock=fail:return+null` 表示消费方对该服务的方法调用在失败后,再返回 null 值,不抛异常。用来容忍不重要服务不稳定时对调用方的影响。 17 | 18 | [^1]: `2.2.0` 以上版本支持 19 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/config-connections.md: -------------------------------------------------------------------------------- 1 | # 连接控制 2 | 3 | ## 服务端连接控制 4 | 5 | 限制服务器端接受的连接不能超过 10 个 [^1]: 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | 或 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | ## 客户端连接控制 18 | 19 | 限制客户端服务使用连接不能超过 10 个 [^2]: 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | 或 26 | 27 | ```xml 28 | 29 | ``` 30 | 31 | 如果 `` 和 `` 都配了 connections,`` 优先,参见:[配置的覆盖策略](../configuration/xml.md) 32 | 33 | [^1]: 因为连接在 Server上,所以配置在 Provider 上 34 | [^2]: 如果是长连接,比如 Dubbo 协议,connections 表示该服务对每个提供者建立的长连接数 35 | 36 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/result-cache.md: -------------------------------------------------------------------------------- 1 | # 结果缓存 2 | 3 | 结果缓存 [^1],用于加速热门数据的访问速度,Dubbo 提供声明式缓存,以减少用户加缓存的工作量 [^2]。 4 | 5 | ## 缓存类型 6 | 7 | * `lru` 基于最近最少使用原则删除多余缓存,保持最热的数据被缓存。 8 | * `threadlocal` 当前线程缓存,比如一个页面渲染,用到很多 portal,每个 portal 都要去查用户信息,通过线程缓存,可以减少这种多余访问。 9 | * `jcache` 与 [JSR107](http://jcp.org/en/jsr/detail?id=107%27) 集成,可以桥接各种缓存实现。 10 | 11 | 缓存类型可扩展,参见:[缓存扩展](../../dubbo-dev-book/impls/cache.md) 12 | 13 | ## 配置 14 | 15 | ```xml 16 | 17 | ``` 18 | 19 | 或: 20 | 21 | ```xml 22 | 23 | 24 | 25 | ``` 26 | 27 | [^1]: `2.1.0` 以上版本支持 28 | [^2]: [示例代码](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-cache) -------------------------------------------------------------------------------- /dubbo-user-book/demos/static-service.md: -------------------------------------------------------------------------------- 1 | # 静态服务 2 | 3 | 有时候希望人工管理服务提供者的上线和下线,此时需将注册中心标识为非动态管理模式。 4 | 5 | ```xml 6 | 7 | ``` 8 | 9 | 或者 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | 服务提供者初次注册时为禁用状态,需人工启用。断线时,将不会被自动删除,需人工禁用。 16 | 17 | 如果是一个第三方独立提供者,比如 memcached,可以直接向注册中心写入提供者地址信息,消费者正常使用 [^1]: 18 | 19 | ```java 20 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 21 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 22 | registry.register(URL.valueOf("memcached://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo")); 23 | ``` 24 | 25 | [^1]: 通常由脚本监控中心页面等调用 -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/subscribe-only.md: -------------------------------------------------------------------------------- 1 | # Subscribe only 2 | 3 | To facilitate the development of tests, it is common to have a registry of all services available in develop environment.And the registration of a service provider under development may affect consumers' inability to run. 4 | 5 | You can let service provider developers only subscribe to services only (services developed may rely on other services) ,don't register services under development and testing services under development with directly connection. 6 | 7 | ![/user-guide/images/subscribe-only.jpg](../sources/images/subscribe-only.jpg) 8 | 9 | User configuration: 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | or 16 | 17 | ```xml 18 | 19 | ``` -------------------------------------------------------------------------------- /dubbo-user-book-en/capacity-plan.md: -------------------------------------------------------------------------------- 1 | # Capacity plan 2 | 3 | The following data for reference: 4 | 5 | ## Use member service project of Dubbo 6 | 7 | * Receive 400,000,000 remote calls one day 8 | * Use 12 standard servers to provide services (CPU:8 core, memory: 8G) 9 | * The average load is less than 1 (For 8 core CPU, the load is very low) 10 | * The average response time is 2.3 to 2.5 ms,Network cost about 1.5 to 1.6 ms(Related to the size of the packet ) 11 | 12 | ## Use product authorization service project of Dubbo 13 | 14 | * Receive 300,000,000 remote calls one day 15 | * Use 8 standard servers to provide services (CPU:8 core, memory: 8G) 16 | * The average load is less than 1 (For 8 core CPU, the load is very low) 17 | * The average response time is 1.4 to 2.8 ms,Network cost about 1.0 to 1.1 ms(Related to the size of the packet ) -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/service-group.md: -------------------------------------------------------------------------------- 1 | # Service Group 2 | 3 | When you have multi-impls of a interface,you can distinguish them with the group. 4 | 5 | 6 | ## Service 7 | 8 | ```xml 9 | 10 | 11 | ``` 12 | 13 | ## Reference 14 | 15 | ```xml 16 | 17 | 18 | ``` 19 | 20 | Any group [^1]: 21 | 22 | ```xml 23 | 24 | ``` 25 | 26 | [^1]: supported after version `2.2.0` ,always select only one available group of implementations to invoke. 27 | 28 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/attachment.md: -------------------------------------------------------------------------------- 1 | # 隐式参数 2 | 3 | 可以通过 `RpcContext` 上的 `setAttachment` 和 `getAttachment` 在服务消费方和提供方之间进行参数的隐式传递。 [^1] 4 | 5 | 6 | ![/user-guide/images/context.png](../sources/images/context.png) 7 | 8 | #### 在服务消费方端设置隐式参数 9 | 10 | `setAttachment` 设置的 KV 对,在完成下面一次远程调用会被清空,即多次远程调用要多次设置。 11 | 12 | ```xml 13 | RpcContext.getContext().setAttachment("index", "1"); // 隐式传参,后面的远程调用都会隐式将这些参数发送到服务器端,类似cookie,用于框架集成,不建议常规业务使用 14 | xxxService.xxx(); // 远程调用 15 | // ... 16 | ``` 17 | 18 | #### 在服务提供方端获取隐式参数 19 | 20 | ```java 21 | public class XxxServiceImpl implements XxxService { 22 | 23 | public void xxx() { 24 | // 获取客户端隐式传入的参数,用于框架集成,不建议常规业务使用 25 | String index = RpcContext.getContext().getAttachment("index"); 26 | } 27 | } 28 | ``` 29 | 30 | [^1]: 注意:path, group, version, dubbo, token, timeout 几个 key 是保留字段,请使用其它值。 -------------------------------------------------------------------------------- /dubbo-user-book/demos/local-call.md: -------------------------------------------------------------------------------- 1 | # 本地调用 2 | 3 | 本地调用使用了 injvm 协议,是一个伪协议,它不开启端口,不发起远程调用,只在 JVM 内直接关联,但执行 Dubbo 的 Filter 链。 4 | 5 | ## 配置 6 | 7 | 定义 injvm 协议 8 | 9 | ```xml 10 | 11 | ``` 12 | 13 | 设置默认协议 14 | 15 | ```xml 16 | 17 | ``` 18 | 19 | 设置服务协议 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | 优先使用 injvm 26 | 27 | ```xml 28 | 29 | 30 | ``` 31 | 32 | 或 33 | 34 | ```xml 35 | 36 | 37 | ``` 38 | 39 | 注意:服务暴露与服务引用都需要声明 `injvm="true"` 40 | 41 | ## 自动暴露、引用本地服务 42 | 43 | 从 `2.2.0` 开始,每个服务默认都会在本地暴露。在引用服务的时候,默认优先引用本地服务。如果希望引用远程服务可以使用一下配置强制引用远程服务。 44 | 45 | ```xml 46 | 47 | ``` -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/registry-only.md: -------------------------------------------------------------------------------- 1 | # Register only 2 | 3 | You have two mirroring environments, two registries. 4 | You have deployed one service at only one of the registries, another registries have not had time to deploy, and other applications at both registries need to rely on the service. 5 | At this time, the service provider registers service to another registrar, but the service consumers do not consume the service from another registrar. 6 | 7 | Disable subscription configuration 8 | 9 | ```xml 10 | 11 | 12 | ``` 13 | 14 | or 15 | 16 | ```xml 17 | 18 | 19 | ``` 20 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/multi-versions.md: -------------------------------------------------------------------------------- 1 | # 多版本 2 | 3 | 当一个接口实现,出现不兼容升级时,可以用版本号过渡,版本号不同的服务相互间不引用。 4 | 5 | 可以按照以下的步骤进行版本迁移: 6 | 7 | 0. 在低压力时间段,先升级一半提供者为新版本 8 | 0. 再将所有消费者升级为新版本 9 | 0. 然后将剩下的一半提供者升级为新版本 10 | 11 | 老版本服务提供者配置: 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | 新版本服务提供者配置: 18 | 19 | ```xml 20 | 21 | ``` 22 | 23 | 老版本服务消费者配置: 24 | 25 | ```xml 26 | 27 | ``` 28 | 29 | 新版本服务消费者配置: 30 | 31 | ```xml 32 | 33 | ``` 34 | 35 | 如果不需要区分版本,可以按照以下的方式配置 [^1]: 36 | 37 | ```xml 38 | 39 | ``` 40 | 41 | [^1]: `2.2.0` 以上版本支持 -------------------------------------------------------------------------------- /dubbo-admin-book/ops/dubbo-ops.md: -------------------------------------------------------------------------------- 1 | # 管理控制台运维 2 | 3 | ## 搜索页面 4 | 5 | 当你需要管理 Dubbo 的服务时,首先要搜索到这个服务,然后打开它的管理页面 6 | 7 | ![/admin-guide/images/dubbo-search.png](../sources/images/dubbo-search.png) 8 | 9 | ## 服务提供者页面 10 | 11 | ![/admin-guide/images/dubbo-providers.png](../sources/images/dubbo-providers.png) 12 | 13 | ## 服务消费者页面 14 | 15 | ![/admin-guide/images/dubbo-consumers.png](../sources/images/dubbo-consumers.png) 16 | 17 | ## 服务应用页面 18 | 19 | ![/admin-guide/images/dubbo-applications.png](../sources/images/dubbo-applications.png) 20 | 21 | ## 添加路由规则页面 22 | 23 | ![/admin-guide/images/dubbo-add-route.png](../sources/images/dubbo-add-route.png) 24 | 25 | ## 添加动态配置页面 26 | 27 | ![/admin-guide/images/dubbo-add-config.png](../sources/images/dubbo-add-config.png) 28 | 29 | ##### 服务注册 30 | ##### 服务降级 31 | ##### 路由规则 32 | ##### 访问控制 33 | ##### 动态配置 34 | ##### 权重调节 35 | ##### 负载均衡 36 | ##### 服务负责人 -------------------------------------------------------------------------------- /dubbo-user-book-en/coveragence.md: -------------------------------------------------------------------------------- 1 | # Test coverage report 2 | 3 | Based on version `2.0.12`,Statistics on 2012-02-03 4 | 5 | ![/sources/images/code-quality1.jpg](sources/images/code-quality1.jpg) 6 | 7 | ![/sources/images/code-quality2.jpg](sources/images/code-quality2.jpg) 8 | 9 | ![/sources/images/code-quality3.jpg](sources/images/code-quality3.jpg) 10 | 11 | ![/sources/images/code-quality4.jpg](sources/images/code-quality4.jpg) 12 | 13 | ![/sources/images/code-quality5.jpg](sources/images/code-quality5.jpg) 14 | 15 | ![/sources/images/code-quality6.jpg](sources/images/code-quality6.jpg) 16 | 17 | ![/sources/images/code-quality7.jpg](sources/images/code-quality7.jpg) 18 | 19 | ![/sources/images/code-coverage.jpg](sources/images/code-coverage.jpg) 20 | 21 | ![/sources/images/code-tendency.jpg](sources/images/code-tendency.jpg) 22 | 23 | ![/sources/images/code-dependency.jpg](sources/images/code-dependency.jpg) -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/echo-service.md: -------------------------------------------------------------------------------- 1 | # Echo Testing 2 | 3 | Echo testing is used for check the service is available,Echo testing is performed according to the normal request flow and is able to test whether the entire call is unobstructed and can be used for monitoring. 4 | 5 | All the services will be automatically implemented `EchoService` interface,just cast any service reference to `EchoService` to use it. 6 | 7 | Spring configuration: 8 | 9 | ```xml 10 | 11 | ``` 12 | 13 | The java code: 14 | 15 | ```java 16 | // reference the remote service 17 | MemberService memberService = ctx.getBean("memberService"); 18 | // case the service reference to EchoService 19 | EchoService echoService = (EchoService) memberService; 20 | 21 | // Echo test usability 22 | String status = echoService.$echo("OK"); 23 | 24 | assert(status.equals("OK")); 25 | ``` 26 | -------------------------------------------------------------------------------- /dubbo-dev-book/release.md: -------------------------------------------------------------------------------- 1 | # 版本管理 2 | 3 | **新功能的开发** 和 **稳定性的提高** 对产品都很重要。但是添加新功能会影响稳定性,Dubbo 使用如下的版本开发模式来保障两者。 4 | 5 | ## 2 个版本并行开发 6 | 7 | * BugFix 版本:低版本,比如 `2.4.x`。是 GA 版本,线上使用的版本,只会 BugFix,升级第三位版本号。 8 | * 新功能版本:高版本,比如 `2.5.x`。加新功能的版本,会给对新功能有需求的应用试用。 9 | 10 | `2.5.x` 的新功能基本稳定后,进入 `2.5.x` 试用阶段。找足够多的应用试用 `2.5.x` 版本。 11 | 12 | 在 `2.5.x` 够稳定后: 13 | 14 | * `2.5.x` 成为 GA 版本,只 BugFix,推广使用此版本。如何可行,可以推进应用在期望的时间点内升级到 GA 版本。 15 | * `2.4.x` 不再开发,应用碰到 Bug 让直接升级。(这个称为“夕阳条款”) 16 | * 从 `2.5.x` 拉成分支 `2.6.0`,作为新功能开发版本。 17 | 18 | ## 优势 19 | 20 | * 保持 GA 版本是稳定的!因为: 21 | * 只会作 BugFix 22 | * 成为 GA 版本前有试用阶段 23 | * 新功能可以高版本中快速响应,并让应用能试用新功能。 24 | * 不会版本过多,导致开发和维护成本剧增 25 | 26 | ## 用户要配合的职责 27 | 28 | 由于开发只会 BugFix GA 版本,所以用户需要积极跟进升级到 GA 版本,以 Fix 发现的问题。 29 | 30 | 定期升级版本用户带来了不安。这是一个假命题,说明如下: 31 | 32 | * GA 经过一个试用阶段保持稳定。 33 | * GA 版本有 Bug 会火速 Fix 34 | * 相对出问题才升级到 GA 版本(可以跨了多个版本)定期升级平摊风险(类似小步快跑)。经历过周期长的大项目的同学会有这样的经历,三方库版本长时间不升级,结果出了问题不得不升级到新版本(跨了多个版本)风险巨大。 35 | -------------------------------------------------------------------------------- /dubbo-user-book/references/protocol/thrift.md: -------------------------------------------------------------------------------- 1 | # thrift:// 2 | 3 | 当前 dubbo 支持 [^1]的 thrift 协议是对 thrift 原生协议 [^2] 的扩展,在原生协议的基础上添加了一些额外的头信息,比如 service name,magic number 等。 4 | 5 | 使用 dubbo thrift 协议同样需要使用 thrift 的 idl compiler 编译生成相应的 java 代码,后续版本中会在这方面做一些增强。 6 | 7 | ## 依赖 8 | 9 | ```xml 10 | 11 | org.apache.thrift 12 | libthrift 13 | 0.8.0 14 | 15 | ``` 16 | 17 | ## 配置 18 | 19 | 所有服务共用一个端口 [^3]: 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | ## 使用 26 | 27 | 可以参考 [dubbo 项目中的示例代码](https://github.com/apache/incubator-dubbo/tree/master/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/protocol/thrift/examples) 28 | 29 | ## 常见问题 30 | 31 | * Thrift 不支持 null 值,即:不能在协议中传递 null 值 32 | 33 | [^1]: `2.3.0` 以上版本支持 34 | [^2]: [Thrift](http://thrift.apache.org) 是 Facebook 捐给 Apache 的一个 RPC 框架 35 | [^3]: 与原生Thrift不兼容 -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/netty4.md: -------------------------------------------------------------------------------- 1 | Add support for netty4 communication module in 2.5.6 version of dubbo, enabled as follows: 2 | 3 | provider: 4 | ```xml 5 | 6 | ``` 7 | 8 | or 9 | 10 | ```xml 11 | 12 | ``` 13 | 14 | consumer: 15 | ```xml 16 | 17 | 18 | ``` 19 | 20 | > **NOTES** 21 | > 1. If provider need to use different communication layer framework for different protocols , please configure multiple protocols separately. 22 | > 2. consumer configuration as follow: 23 | > ```xml 24 | > 25 | > 26 | > 27 | > ``` 28 | > ```xml 29 | > 30 | > 31 | > 32 | > ``` 33 | 34 | > Next we will continue to do something: 35 | > 1. We will provide a reference data on the performance test indicators and performance test comparison with the version of netty 3. 36 | -------------------------------------------------------------------------------- /dubbo-user-book/references/registry/multicast.md: -------------------------------------------------------------------------------- 1 | # Multicast 注册中心 2 | 3 | Multicast 注册中心不需要启动任何中心节点,只要广播地址一样,就可以互相发现。 4 | 5 | ![/user-guide/images/multicast.jpg](../../sources/images/multicast.jpg) 6 | 7 | 0. 提供方启动时广播自己的地址 8 | 1. 消费方启动时广播订阅请求 9 | 2. 提供方收到订阅请求时,单播自己的地址给订阅者,如果设置了 `unicast=false`,则广播给订阅者 10 | 3. 消费方收到提供方地址时,连接该地址进行 RPC 调用。 11 | 12 | 组播受网络结构限制,只适合小规模应用或开发阶段使用。组播地址段: 224.0.0.0 - 239.255.255.255 13 | 14 | ## 配置 15 | 16 | ```xml 17 | 18 | ``` 19 | 20 | 或 21 | 22 | ```xml 23 | 24 | ``` 25 | 26 | 为了减少广播量,Dubbo 缺省使用单播发送提供者地址信息给消费者,如果一个机器上同时启了多个消费者进程,消费者需声明 `unicast=false`,否则只会有一个消费者能收到消息: 27 | 28 | ```xml 29 | 30 | ``` 31 | 32 | 或 33 | 34 | ```xml 35 | 36 | 37 | 38 | ``` -------------------------------------------------------------------------------- /dubbo-user-book/demos/token-authorization.md: -------------------------------------------------------------------------------- 1 | # 令牌验证 2 | 3 | 通过令牌验证在注册中心控制权限,以决定要不要下发令牌给消费者,可以防止消费者绕过注册中心访问提供者,另外通过注册中心可灵活改变授权方式,而不需修改或升级提供者 4 | 5 | ![/user-guide/images/dubbo-token.jpg](../sources/images/dubbo-token.jpg) 6 | 7 | 可以全局设置开启令牌验证: 8 | 9 | ```xml 10 | 11 | 12 | ``` 13 | 或 14 | 15 | ```xml 16 | 17 | 18 | ``` 19 | 20 | 也可在服务级别设置: 21 | 22 | ```xml 23 | 24 | 25 | ``` 26 | 或 27 | 28 | ```xml 29 | 30 | 31 | ``` 32 | 33 | 还可在协议级别设置: 34 | 35 | ```xml 36 | 37 | 38 | ``` 39 | 或 40 | 41 | ```xml 42 | 43 | 44 | ``` 45 | -------------------------------------------------------------------------------- /dubbo-admin-book/install/introduction.md: -------------------------------------------------------------------------------- 1 | # 安装手册 2 | 3 | 你可以只运行 Demo Provider 和 Demo Consumer,它们缺省配置为通过 Multicast [^1] 注册中心广播互相发现,建议在不同机器上运行,如果在同一机器上,需设置 `unicast=false`:即: `multicast://224.5.6.7:1234?unicast=false`,否则发给消费者的单播消息可能被提供者抢占,两个消费者在同一台机器也一样,只有 multicast 注册中心有此问题。 4 | 5 | 你也可以运行多个 Demo Provider 和 Demo Consumer,来验证软负载均衡,Demo Consumer 可以直接启动多个实例,而多个 Demo Provider 因有端口冲突,可在不同机器上运行,或者修改 Demo Provider 安装目录下 `conf/dubbo.properties` 配置中的 `dubbo.protocol.port` 的值。 6 | 7 | 你也可以增加运行 Simple Monitor 监控中心,它缺省配置为通过 Multicast 注册中心广播发现 Provider 和 Consumer,并展示出它们的依赖关系,以及它们之间调用的次数和时间。 8 | 9 | 你也可以将 Multicast 注册中心换成 Zookeeper 注册中心,安装 Zookeeper Registry 后,修改 Demo Proivder,Demo Consumer,Simple Monitor 三者安装目录下的 `conf/dubbo.properties`,将 `dubbo.registry.address` 的值改为 `zookeeper://127.0.0.1:2181`,同理,如果换成 Redis Registry,值改为 `redis://127.0.0.1:6379`,如果换成 Simple Registry,值改为 `dubbo://127.0.0.1:9090` 10 | 11 | 推荐使用 Zookeeper 注册中心 12 | 13 | [^1]: 注意:multicast 地址不能配成 127.0.0.1,也不能配成机器的 IP 地址,必须是 D 段广播地址,也就是:224.0.0.0 到 239.255.255.255 之间的任意地址 -------------------------------------------------------------------------------- /dubbo-user-book/preface/usage.md: -------------------------------------------------------------------------------- 1 | # 用法 2 | 3 | ## 本地服务 Spring 配置 4 | 5 | local.xml: 6 | 7 | ```xml 8 | 9 | 10 | 11 | 12 | ``` 13 | 14 | ## 远程服务 Spring 配置 15 | 16 | 在本地服务的基础上,只需做简单配置,即可完成远程化: 17 | 18 | * 将上面的 `local.xml` 配置拆分成两份,将服务定义部分放在服务提供方 `remote-provider.xml`,将服务引用部分放在服务消费方 `remote-consumer.xml`。 19 | * 并在提供方增加暴露服务配置 ``,在消费方增加引用服务配置 ``。 20 | 21 | remote-provider.xml: 22 | 23 | ```xml 24 | 25 | 26 | 27 | 28 | ``` 29 | 30 | remote-consumer.xml: 31 | 32 | ```xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | ``` -------------------------------------------------------------------------------- /dubbo-user-book-en/references/protocol/thrift.md: -------------------------------------------------------------------------------- 1 | # thrift:// 2 | 3 | The current dubbo support thrift protocol is an extension of the thrift native protocol, adding some additional header information to the native protocol, such as service name, magic number, and so on. 4 | 5 | The use of dubbo thrift protocol also need to use thrift idl compiler to generate the corresponding java code, follow-up version will do some enhancement in this aspect. 6 | 7 | ## dependency 8 | 9 | ```xml 10 | 11 | org.apache.thrift 12 | libthrift 13 | 0.8.0 14 | 15 | ``` 16 | 17 | ## Configuration 18 | 19 | 20 | ```xml 21 | 22 | ``` 23 | 24 | ## Example 25 | 26 | you can check [dubbo thrift example](https://github.com/apache/incubator-dubbo/tree/master/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/protocol/thrift/examples) 27 | 28 | ## Common problem 29 | 30 | * Thrift does not support null values, that is, you can not pass null values 31 | 32 | 33 | -------------------------------------------------------------------------------- /dubbo-user-book/benchmark-tool.md: -------------------------------------------------------------------------------- 1 | # 基准测试工具包 2 | 3 | * 下载源码: git clone https://github.com/apache/incubator-dubbo.git 4 | * 编译benchmark: cd incubator-dubbo/dubbo-test/dubbo-test-benchmark; mvn clean install 5 | * 解压 benchmark压缩包: incubator-dubbo/dubbo-test/dubbo-test-benchmark/target/dubbo-test-benchmark-2.6.2-SNAPSHOT.tar.gz 6 | 7 | 阅读ReadMe.txt(内容如下,请以压缩包内的为准) 8 | 9 | * 新建一个benchmark工程,如demo.benchmark 10 | * 导入自己服务的接口api包和dubbo.benchmark.jar(解压dubbo.benchmark.tar.gz,在lib目录下) 11 | * 新建一个类,实现AbstractClientRunnable 12 | 13 | * 实现父类的构造函数 14 | * 实现invoke方法,通过serviceFactory创建本地接口代理,并实现自己的业务逻辑,如下 15 | 16 | ```java 17 | public Object invoke(ServiceFactory serviceFactory) { 18 | DemoService demoService = (DemoService) serviceFactory.get(DemoService.class); 19 | return demoService.sendRequest("hello"); 20 | } 21 | ``` 22 | * 将自己的benchmark工程打成jar包,如demo.benchmark.jar 23 | * 将demo.benchmark.jar 和服务的api包放到dubbo.benchmark/lib目录下 24 | * 配置duubo.properties 25 | * 运行run.bat(windows)或run.sh(linux) 26 | 27 | 如想测试dubbo的不同版本,直接替换lib下的dubbo的jar包即可。 28 | 29 | -------------------------------------------------------------------------------- /dubbo-admin-book/install/admin-console.md: -------------------------------------------------------------------------------- 1 | # 管理控制台安装 2 | 3 | 管理控制台为内部裁剪版本,开源部分主要包含:路由规则,动态配置,服务降级,访问控制,权重调整,负载均衡,等管理功能。 4 | 5 | 安装: 6 | 7 | ```sh 8 | wget https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz 9 | tar zxvf apache-tomcat-6.0.35.tar.gz 10 | cd apache-tomcat-6.0.35 11 | rm -rf webapps/ROOT 12 | 13 | git clone https://github.com/dubbo/dubbo-ops.git /var/tmp/dubbo-ops 14 | pushd /var/tmp/dubbo-ops 15 | mvn clean package 16 | popd 17 | 18 | unzip /var/tmp/dubbo-ops/dubbo-admin/target/dubbo-admin-2.0.0.war -d webapps/ROOT 19 | ``` 20 | 21 | 配置 [^1]: 22 | 23 | ```sh 24 | vi webapps/ROOT/WEB-INF/dubbo.properties 25 | dubbo.properties 26 | dubbo.registry.address=zookeeper://127.0.0.1:2181 27 | dubbo.admin.root.password=root 28 | dubbo.admin.guest.password=guest 29 | ``` 30 | 31 | 启动: 32 | 33 | ```sh 34 | ./bin/startup.sh 35 | ``` 36 | 37 | 停止: 38 | 39 | ```sh 40 | ./bin/shutdown.sh 41 | ``` 42 | 43 | 访问 [^2]: 44 | 45 | ``` 46 | http://127.0.0.1:8080/ 47 | ``` 48 | 49 | [^1]: 或将 `dubbo.properties` 放在当前用户目录下 50 | [^2]: 用户: root, 密码: root 或者 用户: guest, 密码: guest -------------------------------------------------------------------------------- /dubbo-user-book/demos/hostname-binding.md: -------------------------------------------------------------------------------- 1 | # 主机绑定 2 | 3 | ## 查找顺序 4 | 5 | 缺省主机 IP 查找顺序: 6 | 7 | * 通过 `LocalHost.getLocalHost()` 获取本机地址。 8 | * 如果是 `127.*` 等 loopback 地址,则扫描各网卡,获取网卡 IP。 9 | 10 | ## 主机配置 11 | 12 | 注册的地址如果获取不正确,比如需要注册公网地址,可以: 13 | 14 | 1. 可以在 `/etc/hosts` 中加入:机器名 公网 IP,比如: 15 | 16 | ``` 17 | test1 205.182.23.201 18 | ``` 19 | 20 | 2. 在 `dubbo.xml` 中加入主机地址的配置: 21 | 22 | ```xml 23 | 24 | ``` 25 | 26 | 3. 或在 `dubbo.properties` 中加入主机地址的配置: 27 | 28 | ```properties 29 | dubbo.protocol.host=205.182.23.201 30 | ``` 31 | 32 | ## 端口配置 33 | 34 | 缺省主机端口与协议相关: 35 | 36 | 协议 | 端口 37 | ------------- | ------------- 38 | dubbo | 20880 39 | rmi | 1099 40 | http | 80 41 | hessian | 80 42 | webservice | 80 43 | memcached | 11211 44 | redis | 6379 45 | 46 | 可以按照下面的方式配置端口: 47 | 48 | 1. 在 `dubbo.xml` 中加入主机地址的配置: 49 | 50 | ```xml 51 | 52 | ``` 53 | 54 | 2. 或在 `dubbo.properties` 中加入主机地址的配置: 55 | 56 | ```properties 57 | dubbo.protocol.dubbo.port=20880 58 | ``` -------------------------------------------------------------------------------- /dubbo-admin-book-en/ops/dubbo-ops.md: -------------------------------------------------------------------------------- 1 | # Ops console management 2 | 3 | ## Page search 4 | 5 | If you need to manage a Dubbo service, you need to search it first and open it's management page 6 | 7 | ![/admin-guide/images/dubbo-search.png](../sources/images/dubbo-search.png) 8 | 9 | ## Service provider page 10 | 11 | ![/admin-guide/images/dubbo-providers.png](../sources/images/dubbo-providers.png) 12 | 13 | ## Service consumer page 14 | 15 | ![/admin-guide/images/dubbo-consumers.png](../sources/images/dubbo-consumers.png) 16 | 17 | ## Service application page 18 | 19 | ![/admin-guide/images/dubbo-applications.png](../sources/images/dubbo-applications.png) 20 | 21 | ## Add route rule page 22 | 23 | ![/admin-guide/images/dubbo-add-route.png](../sources/images/dubbo-add-route.png) 24 | 25 | ## Add dynamic configuration page 26 | 27 | ![/admin-guide/images/dubbo-add-config.png](../sources/images/dubbo-add-config.png) 28 | 29 | ##### Service register 30 | ##### Service downgrade 31 | ##### Route rule 32 | ##### Access control 33 | ##### Dynamic configuration 34 | ##### Weight adjustment 35 | ##### Load balance 36 | ##### Service owner 37 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/compiler.md: -------------------------------------------------------------------------------- 1 | # 编译器扩展 2 | 3 | ## 扩展说明 4 | 5 | Java 代码编译器,用于动态生成字节码,加速调用。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.common.compiler.Compiler` 10 | 11 | ## 扩展配置 12 | 13 | 自动加载 14 | 15 | ## 已知扩展 16 | 17 | * `com.alibaba.dubbo.common.compiler.support.JdkCompiler` 18 | * `com.alibaba.dubbo.common.compiler.support.JavassistCompiler` 19 | 20 | ## 扩展示例 21 | 22 | Maven 项目结构: 23 | 24 | ``` 25 | src 26 | |-main 27 | |-java 28 | |-com 29 | |-xxx 30 | |-XxxCompiler.java (实现Compiler接口) 31 | |-resources 32 | |-META-INF 33 | |-dubbo 34 | |-com.alibaba.dubbo.common.compiler.Compiler (纯文本文件,内容为:xxx=com.xxx.XxxCompiler) 35 | ``` 36 | 37 | XxxCompiler.java: 38 | 39 | ```java 40 | package com.xxx; 41 | 42 | import com.alibaba.dubbo.common.compiler.Compiler; 43 | 44 | public class XxxCompiler implements Compiler { 45 | public Object getExtension(Class type, String name) { 46 | // ... 47 | } 48 | } 49 | ``` 50 | 51 | META-INF/dubbo/com.alibaba.dubbo.common.compiler.Compiler: 52 | 53 | ```properties 54 | xxx=com.xxx.XxxCompiler 55 | ``` 56 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/result-cache.md: -------------------------------------------------------------------------------- 1 | # Cache Result 2 | 3 | Cache Result [^1] is used to speed up access to popular data. Dubbo provides declarative caching to reduce the user work of adding cache [^2]。 4 | 5 | ## Cache Type 6 | 7 | * `lru` Delete excess cache Based on the principle of least recently used. The hottest data is cached. 8 | * `threadlocal` The current thread cache. For example, a page have a lot of portal and each portal need to check user information, you can reduce this redundant visit with this cache. 9 | * `jcache` integrate with [JSR107](http://jcp.org/en/jsr/detail?id=107%27) , you can bridge a variety of cache implementation。 10 | 11 | Caching type can be extended,refer to:[Cache extension](../../dubbo-dev-book-en/impls/cache.md) 12 | 13 | ## Configuration 14 | 15 | ```xml 16 | 17 | ``` 18 | 19 | or: 20 | 21 | ```xml 22 | 23 | 24 | 25 | ``` 26 | 27 | [^1]: Support since `2.1.0` 28 | [^2]: [Sample](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-cache) -------------------------------------------------------------------------------- /dubbo-admin-book/install/redis.md: -------------------------------------------------------------------------------- 1 | # Redis 注册中心安装 2 | 3 | 4 | 5 | Redis [^1] 使用方式参见: [Redis 注册中心参考手册](../../dubbo-user-book/references/registry/redis.md)。 6 | 7 | 只需搭一个原生的 Redis 服务器,并将[快速启动](../../dubbo-user-book/quick-start.md)中 Provider 和 Consumer 里的 `conf/dubbo.properties` 中的 `dubbo.registry.addrss` 的值改为 `redis://127.0.0.1:6379` 即可使用。 8 | 9 | Redis 注册中心集群 [^2] 采用在客户端同时写入多个服务器,读取单个服务器的策略实现。 10 | 11 | 安装: 12 | 13 | ```sh 14 | wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/redis/redis-2.4.8.tar.gz 15 | tar xzf redis-2.4.8.tar.gz 16 | cd redis-2.4.8 17 | make 18 | ``` 19 | 20 | 配置: 21 | 22 | ```sh 23 | vi redis.conf 24 | ``` 25 | 26 | 启动: 27 | 28 | ```sh 29 | nohup ./src/redis-server redis.conf & 30 | ``` 31 | 32 | 停止: 33 | 34 | ```sh 35 | killall redis-server 36 | ``` 37 | 38 | * 命令行 [^3]: 39 | 40 | ```sh 41 | ./src/redis-cli 42 | hgetall /dubbo/com.foo.BarService/providers 43 | ``` 44 | 45 | 或者: 46 | 47 | ```sh 48 | telnet 127.0.0.1 6379 49 | hgetall /dubbo/com.foo.BarService/providers 50 | ``` 51 | 52 | [^1]: Redis 是一个高效的 KV 存储服务器,参见:http://redis.io/topics/quickstart 53 | [^2]: `2.1.0` 以上版本支持 54 | [^3]: 参见: http://redis.io/commands 55 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/static-service.md: -------------------------------------------------------------------------------- 1 | # Static Service 2 | 3 | * Sometimes we want to manually manage the registration and deregistration for service provider, we need to set registry to non-dynamoic mode. 4 | 5 | ```xml 6 | 7 | ``` 8 | 9 | Or 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | 16 | dynamic mode is disabled when service provider initially registers, then we need to enable it manually. When disconnects, the setting will not be deleted automatically, need to disable it manually. 17 | 18 | For a third party service provider like “memcachd”, it can directly write the address information of service provider to registry, which can be used by consumer. 19 | 20 | ```java 21 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 22 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 23 | registry.register(URL.valueOf("memcached://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo")); 24 | ``` 25 | 26 | 27 | [^1]: usually called by monitor system -------------------------------------------------------------------------------- /dubbo-dev-book/impls/merger.md: -------------------------------------------------------------------------------- 1 | # 合并结果扩展 2 | 3 | ## 扩展说明 4 | 5 | 合并返回结果,用于分组聚合。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.rpc.cluster.Merger` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | ## 已知扩展 18 | 19 | * `com.alibaba.dubbo.rpc.cluster.merger.ArrayMerger` 20 | * `com.alibaba.dubbo.rpc.cluster.merger.ListMerger` 21 | * `com.alibaba.dubbo.rpc.cluster.merger.SetMerger` 22 | * `com.alibaba.dubbo.rpc.cluster.merger.MapMerger` 23 | 24 | ## 扩展示例 25 | 26 | Maven 项目结构: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxMerger.java (实现Merger接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.cluster.Merger (纯文本文件,内容为:xxx=com.xxx.XxxMerger) 39 | ``` 40 | 41 | XxxMerger.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.cluster.Merger; 47 | 48 | public class XxxMerger implements Merger { 49 | public T merge(T... results) { 50 | // ... 51 | } 52 | } 53 | ``` 54 | 55 | META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.Merger: 56 | 57 | ```properties 58 | xxx=com.xxx.XxxMerger 59 | ``` 60 | 61 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/service-donwngrade.md: -------------------------------------------------------------------------------- 1 | # Service-Downgrade 2 | 3 | You can temporarilly shield a non-critical service through the service downgrade and define the return policy for it. 4 | 5 | 6 | Publish dynamic configuration rule to the registry: 7 | 8 | ```java 9 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 10 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 11 | registry.register(URL.valueOf("override://0.0.0.0/com.foo.BarService?category=configurators&dynamic=false&application=foo&mock=force:return+null")); 12 | ``` 13 | 14 | * The configuration `mock=force:return+null` means that all calls of this service will return null value directly,without making remote calls.Usually used to reduce the effect of some slow non-critical services. 15 | 16 | * Also you can change that configuration to `mock=fail:return+null`.Then you will get null value after a failed call.Consumer will try to make a remote call to get the truely result if succeed,and if the call failed you will get null value.Usually used to tolerate some non-critical services. 17 | 18 | 19 | [^1]: supported after version `2.2.0` 20 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/thread-model.md: -------------------------------------------------------------------------------- 1 | # 线程模型 2 | 3 | 如果事件处理的逻辑能迅速完成,并且不会发起新的 IO 请求,比如只是在内存中记个标识,则直接在 IO 线程上处理更快,因为减少了线程池调度。 4 | 5 | 但如果事件处理逻辑较慢,或者需要发起新的 IO 请求,比如需要查询数据库,则必须派发到线程池,否则 IO 线程阻塞,将导致不能接收其它请求。 6 | 7 | 如果用 IO 线程处理事件,又在事件处理过程中发起新的 IO 请求,比如在连接事件中发起登录请求,会报“可能引发死锁”异常,但不会真死锁。 8 | 9 | ![dubbo-protocol](../sources/images/dubbo-protocol.jpg) 10 | 11 | 12 | 因此,需要通过不同的派发策略和不同的线程池配置的组合来应对不同的场景: 13 | 14 | ```xml 15 | 16 | ``` 17 | 18 | Dispatcher 19 | 20 | * `all` 所有消息都派发到线程池,包括请求,响应,连接事件,断开事件,心跳等。 21 | * `direct` 所有消息都不派发到线程池,全部在 IO 线程上直接执行。 22 | * `message` 只有请求响应消息派发到线程池,其它连接断开事件,心跳等消息,直接在 IO 线程上执行。 23 | * `execution` 只请求消息派发到线程池,不含响应,响应和其它连接断开事件,心跳等消息,直接在 IO 线程上执行。 24 | * `connection` 在 IO 线程上,将连接断开事件放入队列,有序逐个执行,其它消息派发到线程池。 25 | 26 | ThreadPool 27 | 28 | * `fixed` 固定大小线程池,启动时建立线程,不关闭,一直持有。(缺省) 29 | * `cached` 缓存线程池,空闲一分钟自动删除,需要时重建。 30 | * `limited` 可伸缩线程池,但池中的线程数只会增长不会收缩。只增长不收缩的目的是为了避免收缩时突然来了大流量引起的性能问题。 31 | * `eager` 优先创建`Worker`线程池。在任务数量大于`corePoolSize`但是小于`maximumPoolSize`时,优先创建`Worker`来处理任务。当任务数量大于`maximumPoolSize`时,将任务放入阻塞队列中。阻塞队列充满时抛出`RejectedExecutionException`。(相比于`cached`:`cached`在任务数量超过`maximumPoolSize`时直接抛出异常而不是将任务放入阻塞队列) -------------------------------------------------------------------------------- /dubbo-dev-book-en/TCK.md: -------------------------------------------------------------------------------- 1 | # Compatibility test 2 | 3 | Dubbo's protocol, communication, serialization, registry, load balancing and other SPI all offer alternative strategies for different application scenarios while our test cases are very scattered. Ours is always uncertain whether it can satisfy the complete contract of the extension point when users need to add a new implementation. 4 | 5 | Thus we need to use TCK (Technology Compatibility Kit) for the core extension points. When users add a new implementaion, compatibility with the rest of the framework can be ensured with TCK. This can effectively improve the overall health and also facilitate the access of the third party extenders, which accelerates the maturity of the open source community. 6 | 7 | Xingzhi from the open source community is already working on this part. His preliminary idea is to build a TCK framework for Dubbo drawing on the CDI-TCK of JBoss first, then realize the TCK implementing case of Dubbo. 8 | 9 | Reference:http://docs.jboss.org/cdi/tck/reference/1.0.1-Final/html/introduction.html 10 | 11 | Anyone interested is welcomed to work on this together. 12 | 13 | #### Protocol TCK 14 | 15 | > TODO 16 | 17 | #### Registry TCK 18 | 19 | > TODO -------------------------------------------------------------------------------- /dubbo-admin-book-en/install/admin-console.md: -------------------------------------------------------------------------------- 1 | # Install admin console 2 | 3 | Include: route rule, dynamic configuration, service downgrade, access control, weight adjustment, load balance, etc. 4 | 5 | Install: 6 | 7 | ```sh 8 | wget https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz 9 | tar zxvf apache-tomcat-6.0.35.tar.gz 10 | cd apache-tomcat-6.0.35 11 | rm -rf webapps/ROOT 12 | 13 | git clone https://github.com/dubbo/dubbo-ops.git /var/tmp/dubbo-ops 14 | pushd /var/tmp/dubbo-ops 15 | mvn clean package 16 | popd 17 | 18 | unzip /var/tmp/dubbo-ops/dubbo-admin/target/dubbo-admin-2.0.0.war -d webapps/ROOT 19 | ``` 20 | 21 | Configuration [^1]: 22 | 23 | ```sh 24 | vi webapps/ROOT/WEB-INF/dubbo.properties 25 | dubbo.properties 26 | dubbo.registry.address=zookeeper://127.0.0.1:2181 27 | dubbo.admin.root.password=root 28 | dubbo.admin.guest.password=guest 29 | ``` 30 | 31 | Start: 32 | 33 | ```sh 34 | ./bin/startup.sh 35 | ``` 36 | 37 | Stop: 38 | 39 | ```sh 40 | ./bin/shutdown.sh 41 | ``` 42 | 43 | Visit [^2]: 44 | 45 | ``` 46 | http://127.0.0.1:8080/ 47 | ``` 48 | 49 | [^1]: Or put `dubbo.properties` in current user directory 50 | [^2]: User: root, password: root or user: guest, password: guest 51 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/explicit-target.md: -------------------------------------------------------------------------------- 1 | # 直连提供者 2 | 3 | 在开发及测试环境下,经常需要绕过注册中心,只测试指定服务提供者,这时候可能需要点对点直连,点对点直联方式,将以服务接口为单位,忽略注册中心的提供者列表,A 接口配置点对点,不影响 B 接口从注册中心获取列表。 4 | 5 | ![/user-guide/images/dubbo-directly.jpg](../sources/images/dubbo-directly.jpg) 6 | 7 | ## 通过 XML 配置 8 | 9 | 如果是线上需求需要点对点,可在 `` 中配置 url 指向提供者,将绕过注册中心,多个地址用分号隔开,配置如下 [^1]: 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | ## 通过 -D 参数指定 16 | 17 | 在 JVM 启动参数中加入-D参数映射服务地址 [^2],如: 18 | 19 | ```sh 20 | java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890 21 | ``` 22 | 23 | ## 通过文件映射 24 | 25 | 如果服务比较多,也可以用文件映射,用 `-Ddubbo.resolve.file` 指定映射文件路径,此配置优先级高于 `` 中的配置 [^3],如: 26 | 27 | ```sh 28 | java -Ddubbo.resolve.file=xxx.properties 29 | ``` 30 | 31 | 然后在映射文件 `xxx.properties` 中加入配置,其中 key 为服务名,value 为服务提供者 URL: 32 | 33 | ```properties 34 | com.alibaba.xxx.XxxService=dubbo://localhost:20890 35 | ``` 36 | 37 | **注意** 为了避免复杂化线上环境,不要在线上使用这个功能,只应在测试阶段使用。 38 | 39 | [^1]: `1.0.6` 及以上版本支持 40 | [^2]: key 为服务名,value 为服务提供者 url,此配置优先级最高,`1.0.15` 及以上版本支持 41 | [^3]: `1.0.15` 及以上版本支持,`2.0` 以上版本自动加载 ${user.home}/dubbo-resolve.properties文件,不需要配置 42 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/networker.md: -------------------------------------------------------------------------------- 1 | # 组网扩展 2 | 3 | ## 扩展说明 4 | 5 | 对等网络节点组网器。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.remoting.p2p.Networker` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.remoting.p2p.support.MulticastNetworker` 22 | * `com.alibaba.dubbo.remoting.p2p.support.FileNetworker` 23 | 24 | ## 扩展示例 25 | 26 | Maven 项目结构: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxNetworker.java (实现Networker接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.remoting.p2p.Networker (纯文本文件,内容为:xxx=com.xxx.XxxNetworker) 39 | ``` 40 | 41 | XxxNetworker.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.remoting.p2p.Networker; 47 | 48 | public class XxxNetworker implements Networker { 49 | public Group lookup(URL url) { 50 | // ... 51 | } 52 | } 53 | ``` 54 | 55 | META-INF/dubbo/com.alibaba.dubbo.remoting.p2p.Networker: 56 | 57 | ```properties 58 | xxx=com.xxx.XxxNetworker 59 | ``` 60 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/attachment.md: -------------------------------------------------------------------------------- 1 | # Implicit parameters 2 | 3 | You can implicitly pass parameters between service consumers and providers via `setAttachment` and` getAttachment` on `RpcContext`. 4 | ![/user-guide/images/context.png](../sources/images/context.png) 5 | 6 | ## Set the implicit parameters at service consumer side 7 | 8 | Via `setAttachment` on `RpcContext` set key/value pair for implicitly pass parameters.When finished once remote invoke,will be clear,so multi-invoke must set multi-times. 9 | 10 | 11 | ```java 12 | RpcContext.getContext().setAttachment("index", "1"); // implicitly pass parameters,behind the remote call will implicitly send these parameters to the server side, similar to the cookie, for the framework of integration, not recommended for regular business use 13 | xxxService.xxx(); // remote call 14 | // ... 15 | ``` 16 | 17 | ## Fetch the implicit parameters at service provider side 18 | 19 | ```java 20 | public class XxxServiceImpl implements XxxService { 21 | 22 | public void xxx() { 23 | // get parameters which passed by the consumer side,for the framework of integration, not recommended for regular business use 24 | String index = RpcContext.getContext().getAttachment("index"); 25 | } 26 | } 27 | ``` 28 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/container.md: -------------------------------------------------------------------------------- 1 | # 容器扩展 2 | 3 | ## 扩展说明 4 | 5 | 服务容器扩展,用于自定义加载内容。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.container.Container` 10 | 11 | ## 扩展配置 12 | 13 | ```sh 14 | java com.alibaba.dubbo.container.Main spring jetty log4j 15 | ``` 16 | 17 | ## 已知扩展 18 | 19 | * `com.alibaba.dubbo.container.spring.SpringContainer` 20 | * `com.alibaba.dubbo.container.spring.JettyContainer` 21 | * `com.alibaba.dubbo.container.spring.Log4jContainer` 22 | 23 | ## 扩展示例 24 | 25 | Maven 项目结构: 26 | 27 | ``` 28 | src 29 | |-main 30 | |-java 31 | |-com 32 | |-xxx 33 | |-XxxContainer.java (实现Container接口) 34 | |-resources 35 | |-META-INF 36 | |-dubbo 37 | |-com.alibaba.dubbo.container.Container (纯文本文件,内容为:xxx=com.xxx.XxxContainer) 38 | ``` 39 | 40 | XxxContainer.java: 41 | 42 | ```java 43 | package com.xxx; 44 | 45 | com.alibaba.dubbo.container.Container; 46 | 47 | 48 | public class XxxContainer implements Container { 49 | public Status start() { 50 | // ... 51 | } 52 | public Status stop() { 53 | // ... 54 | } 55 | } 56 | ``` 57 | 58 | META-INF/dubbo/com.alibaba.dubbo.container.Container: 59 | 60 | ```properties 61 | xxx=com.xxx.XxxContainer 62 | ``` 63 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/local-stub.md: -------------------------------------------------------------------------------- 1 | # 本地存根 2 | 3 | 远程服务后,客户端通常只剩下接口,而实现全在服务器端,但提供方有些时候想在客户端也执行部分逻辑,比如:做 ThreadLocal 缓存,提前验证参数,调用失败后伪造容错数据等等,此时就需要在 API 中带上 Stub,客户端生成 Proxy 实例,会把 Proxy 通过构造函数传给 Stub [^1],然后把 Stub 暴露给用户,Stub 可以决定要不要去调 Proxy。 4 | 5 | ![/user-guide/images/stub.jpg](../sources/images/stub.jpg) 6 | 7 | 在 spring 配置文件中按以下方式配置: 8 | 9 | ```xml 10 | 11 | ``` 12 | 13 | 或 14 | 15 | ```xml 16 | 17 | ``` 18 | 19 | 提供 Stub 的实现 [^2]: 20 | 21 | ```java 22 | package com.foo; 23 | public class BarServiceStub implements BarService { 24 | private final BarService barService; 25 | 26 | // 构造函数传入真正的远程代理对象 27 | public (BarService barService) { 28 | this.barService = barService; 29 | } 30 | 31 | public String sayHello(String name) { 32 | // 此代码在客户端执行, 你可以在客户端做ThreadLocal本地缓存,或预先验证参数是否合法,等等 33 | try { 34 | return barService.sayHello(name); 35 | } catch (Exception e) { 36 | // 你可以容错,可以做任何AOP拦截事项 37 | return "容错数据"; 38 | } 39 | } 40 | } 41 | ``` 42 | 43 | [^1]: Stub 必须有可传入 Proxy 的构造函数。 44 | [^2]: 在 interface 旁边放一个 Stub 实现,它实现 BarService 接口,并有一个传入远程 BarService 实例的构造函数 45 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/extension-factory.md: -------------------------------------------------------------------------------- 1 | # 扩展点加载扩展 2 | 3 | ## 扩展说明 4 | 5 | 扩展点本身的加载容器,可从不同容器加载扩展点。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.common.extension.ExtensionFactory` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | ## 已知扩展 18 | 19 | * `com.alibaba.dubbo.common.extension.factory.SpiExtensionFactory` 20 | * `com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory` 21 | 22 | ## 扩展示例 23 | 24 | Maven 项目结构: 25 | 26 | ``` 27 | src 28 | |-main 29 | |-java 30 | |-com 31 | |-xxx 32 | |-XxxExtensionFactory.java (实现ExtensionFactory接口) 33 | |-resources 34 | |-META-INF 35 | |-dubbo 36 | |-com.alibaba.dubbo.common.extension.ExtensionFactory (纯文本文件,内容为:xxx=com.xxx.XxxExtensionFactory) 37 | ``` 38 | 39 | XxxExtensionFactory.java: 40 | 41 | ```java 42 | package com.xxx; 43 | 44 | import com.alibaba.dubbo.common.extension.ExtensionFactory; 45 | 46 | public class XxxExtensionFactory implements ExtensionFactory { 47 | public Object getExtension(Class type, String name) { 48 | // ... 49 | } 50 | } 51 | ``` 52 | 53 | META-INF/dubbo/com.alibaba.dubbo.common.extension.ExtensionFactory: 54 | 55 | ```properties 56 | xxx=com.xxx.XxxExtensionFactory 57 | ``` 58 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/generic-service.md: -------------------------------------------------------------------------------- 1 | # 实现泛化调用 2 | 3 | 泛接口实现方式主要用于服务器端没有API接口及模型类元的情况,参数及返回值中的所有POJO均用Map表示,通常用于框架集成,比如:实现一个通用的远程服务Mock框架,可通过实现GenericService接口处理所有服务请求。 4 | 5 | 在 Java 代码中实现 `GenericService` 接口: 6 | 7 | ```java 8 | package com.foo; 9 | public class MyGenericService implements GenericService { 10 | 11 | public Object $invoke(String methodName, String[] parameterTypes, Object[] args) throws GenericException { 12 | if ("sayHello".equals(methodName)) { 13 | return "Welcome " + args[0]; 14 | } 15 | } 16 | } 17 | ``` 18 | 19 | ## 通过 Spring 暴露泛化实现 20 | 21 | 在 Spring 配置申明服务的实现: 22 | 23 | ```xml 24 | 25 | 26 | ``` 27 | 28 | ## 通过 API 方式暴露泛化实现 29 | 30 | ```java 31 | ... 32 | // 用com.alibaba.dubbo.rpc.service.GenericService可以替代所有接口实现 33 | GenericService xxxService = new XxxGenericService(); 34 | 35 | // 该实例很重量,里面封装了所有与注册中心及服务提供方连接,请缓存 36 | ServiceConfig service = new ServiceConfig(); 37 | // 弱类型接口名 38 | service.setInterface("com.xxx.XxxService"); 39 | service.setVersion("1.0.0"); 40 | // 指向一个通用服务实现 41 | service.setRef(xxxService); 42 | 43 | // 暴露及注册服务 44 | service.export(); 45 | ``` 46 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/local-mock.md: -------------------------------------------------------------------------------- 1 | # 本地伪装 2 | 3 | 本地伪装 [^1] 通常用于服务降级,比如某验权服务,当服务提供方全部挂掉后,客户端不抛出异常,而是通过 Mock 数据返回授权失败。 4 | 5 | 在 spring 配置文件中按以下方式配置: 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | 或 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | 在工程中提供 Mock 实现 [^2]: 18 | 19 | ```java 20 | package com.foo; 21 | public class BarServiceMock implements BarService { 22 | public String sayHello(String name) { 23 | // 你可以伪造容错数据,此方法只在出现RpcException时被执行 24 | return "容错数据"; 25 | } 26 | } 27 | ``` 28 | 29 | 如果服务的消费方经常需要 try-catch 捕获异常,如: 30 | 31 | ```java 32 | Offer offer = null; 33 | try { 34 | offer = offerService.findOffer(offerId); 35 | } catch (RpcException e) { 36 | logger.error(e); 37 | } 38 | ``` 39 | 40 | 请考虑改为 Mock 实现,并在 Mock 实现中 return null。如果只是想简单的忽略异常,在 `2.0.11` 以上版本可用: 41 | 42 | ```xml 43 | 44 | ``` 45 | 46 | [^1]: Mock 是 Stub 的一个子集,便于服务提供方在客户端执行容错逻辑,因经常需要在出现 RpcException (比如网络失败,超时等)时进行容错,而在出现业务异常(比如登录用户名密码错误)时不需要容错,如果用 Stub,可能就需要捕获并依赖 RpcException 类,而用 Mock 就可以不依赖 RpcException,因为它的约定就是只有出现 RpcException 时才执行。 47 | [^2]: 在 interface 旁放一个 Mock 实现,它实现 BarService 接口,并有一个无参构造函数 48 | -------------------------------------------------------------------------------- /dubbo-user-book/references/protocol/http.md: -------------------------------------------------------------------------------- 1 | # http:// 2 | 3 | 基于 HTTP 表单的远程调用协议,采用 Spring 的 HttpInvoker 实现 [^1] 4 | 5 | ## 特性 6 | 7 | * 连接个数:多连接 8 | * 连接方式:短连接 9 | * 传输协议:HTTP 10 | * 传输方式:同步传输 11 | * 序列化:表单序列化 12 | * 适用范围:传入传出参数数据包大小混合,提供者比消费者个数多,可用浏览器查看,可用表单或URL传入参数,暂不支持传文件。 13 | * 适用场景:需同时给应用程序和浏览器 JS 使用的服务。 14 | 15 | ## 约束 16 | * 参数及返回值需符合 Bean 规范 17 | 18 | ## 配置 19 | 20 | 配置协议: 21 | 22 | ```xml 23 | 24 | ``` 25 | 26 | 配置 Jetty Server (默认): 27 | 28 | ```xml 29 | 30 | ``` 31 | 32 | 配置 Servlet Bridge Server (推荐使用): 33 | 34 | ```xml 35 | 36 | ``` 37 | 38 | 配置 DispatcherServlet: 39 | 40 | ```xml 41 | 42 | dubbo 43 | com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet 44 | 1 45 | 46 | 47 | dubbo 48 | /* 49 | 50 | ``` 51 | 52 | 注意,如果使用 servlet 派发请求: 53 | 54 | * 协议的端口 `` 必须与 servlet 容器的端口相同, 55 | * 协议的上下文路径 `` 必须与 servlet 应用的上下文路径相同。 56 | 57 | [^1]: `2.3.0` 以上版本支持 -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/config-connections.md: -------------------------------------------------------------------------------- 1 | # Config connections 2 | 3 | ## Control connections at server-side 4 | Limit server-side accept to no more than 10 connections 5 | 6 | ```xml 7 | 8 | ``` 9 | OR 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | ## Control connections at client-side 16 | Limit client-side creating connection to no more than 10 connections for interface `com.foo.BarService`. 17 | ```xml 18 | 19 | ``` 20 | 21 | OR 22 | 23 | ```xml 24 | 25 | ``` 26 | **NOTE:** If used default protocol(`dubbo` protocol), and the value of `connections` attribute is great than 0,then each service reference will has itself connection,else all service which belong to same remote server will share only one connection. In this framework,we called `private` connection or `share` connection. 27 | 28 | If `` and `` are both configured accepts/connections,`` is preferred,Ref to [Configuration coverage strategy](http://dubbo.apache.org/books/dubbo-user-book-en/demos/config-rule.html). 29 | 30 | * : Because connection is connect on Server,so configure at Provider. 31 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/local-call.md: -------------------------------------------------------------------------------- 1 | # Local call 2 | 3 | The local call uses the `injvm` protocol, a pseudo-protocol that does not turn on the port, does not initiate remote calls, is directly associated within the JVM, but executes the Dubbo Filter chain. 4 | 5 | ## Configuration 6 | 7 | Configure `injvm` protocol 8 | 9 | ```xml 10 | 11 | ``` 12 | 13 | Configure default provider 14 | 15 | ```xml 16 | 17 | ``` 18 | 19 | Configure default service 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | Use injvm first 26 | 27 | ```xml 28 | 29 | 30 | ``` 31 | 32 | or 33 | 34 | ```xml 35 | 36 | 37 | ``` 38 | 39 | Note: Both service provider and service references need to declare `injvm="true"` 40 | 41 | ## Automatically exposed, local service references 42 | 43 | `2.2.0` or later, each service is exposed locally by default. When referring to the service, the local service is referenced by default. If you want to reference a remote service, you can use the following configuration to force a reference to a remote service. 44 | 45 | 46 | ```xml 47 | 48 | ``` 49 | -------------------------------------------------------------------------------- /dubbo-admin-book/install/simple-registry-center.md: -------------------------------------------------------------------------------- 1 | # Simple 注册中心安装 2 | 3 | Simple Registry 没有经过严格测试,可能不健状,并且不支持集群,不建议用于生产环境。 4 | 5 | 安装: 6 | 7 | ```sh 8 | git clone https://github.com/apache/incubator-dubbo-ops 9 | cd incubator-dubbo-ops && mvn package 10 | cd dubbo-registry-simple/target && tar xvf dubbo-registry-simple-2.0.0-assembly.tar.gz 11 | cd dubbo-registry-simple-2.0.0 12 | ``` 13 | 14 | 配置: 15 | 16 | ```sh 17 | vi conf/dubbo.properties 18 | ``` 19 | 20 | 启动: 21 | 22 | ```sh 23 | ./assembly.bin/start.sh 24 | ``` 25 | 26 | 停止: 27 | 28 | ```sh 29 | ./assembly.bin/stop.sh 30 | ``` 31 | 32 | 重启: 33 | 34 | ```sh 35 | ./assembly.bin/restart.sh 36 | ``` 37 | 38 | 调试: 39 | 40 | ```sh 41 | ./assembly.bin/start.sh debug 42 | ``` 43 | 44 | 系统状态: 45 | 46 | ```sh 47 | ./assembly.bin/dump.sh 48 | ``` 49 | 50 | 总控入口: 51 | 52 | ```sh 53 | ./assembly.bin/server.sh start 54 | ./assembly.bin/server.sh stop 55 | ./assembly.bin/server.sh restart 56 | ./assembly.bin/server.sh debug 57 | ./assembly.bin/server.sh dump 58 | ``` 59 | 60 | 标准输出: 61 | 62 | ```sh 63 | tail -f logs/stdout.log 64 | ``` 65 | 66 | 命令行 [^1]: 67 | 68 | ```shell 69 | telnet 127.0.0.1 9090 70 | help 71 | ``` 72 | 73 | 或者: 74 | 75 | ```sh 76 | echo status | nc -i 1 127.0.0.1 9090 77 | ``` 78 | 79 | [^1]: 请参考 [Telnet 命令参考手册](../../dubbo-user-book/references/telnet.md) 80 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/threadpool.md: -------------------------------------------------------------------------------- 1 | # 线程池扩展 2 | 3 | ## 扩展说明 4 | 5 | 服务提供方线程程实现策略,当服务器收到一个请求时,需要在线程池中创建一个线程去执行服务提供方业务逻辑。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.common.threadpool.ThreadPool` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.common.threadpool.FixedThreadPool` 22 | * `com.alibaba.dubbo.common.threadpool.CachedThreadPool` 23 | 24 | ## 扩展示例 25 | 26 | Maven 项目结构: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxThreadPool.java (实现ThreadPool接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.common.threadpool.ThreadPool (纯文本文件,内容为:xxx=com.xxx.XxxThreadPool) 39 | ``` 40 | 41 | XxxThreadPool.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.common.threadpool.ThreadPool; 47 | import java.util.concurrent.Executor; 48 | 49 | public class XxxThreadPool implements ThreadPool { 50 | public Executor getExecutor() { 51 | // ... 52 | } 53 | } 54 | ``` 55 | 56 | META-INF/dubbo/com.alibaba.dubbo.common.threadpool.ThreadPool: 57 | 58 | ```properties 59 | xxx=com.xxx.XxxThreadPool 60 | ``` 61 | 62 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/merger.md: -------------------------------------------------------------------------------- 1 | # Merger Extension 2 | 3 | ## Summary 4 | 5 | Merge strategy for return result aggregation in group. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.rpc.cluster.Merger` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | ## Existing Extension 18 | 19 | * `com.alibaba.dubbo.rpc.cluster.merger.ArrayMerger` 20 | * `com.alibaba.dubbo.rpc.cluster.merger.ListMerger` 21 | * `com.alibaba.dubbo.rpc.cluster.merger.SetMerger` 22 | * `com.alibaba.dubbo.rpc.cluster.merger.MapMerger` 23 | 24 | ## Extension Guide 25 | 26 | Directory layout: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxMerger.java (Merger implementation) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.cluster.Merger (plain text file with the content: xxx=com.xxx.XxxMerger) 39 | ``` 40 | 41 | XxxMerger.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.cluster.Merger; 47 | 48 | public class XxxMerger implements Merger { 49 | public T merge(T... results) { 50 | // ... 51 | } 52 | } 53 | ``` 54 | 55 | META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.Merger: 56 | 57 | ```properties 58 | xxx=com.xxx.XxxMerger 59 | ``` 60 | 61 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/router.md: -------------------------------------------------------------------------------- 1 | # 路由扩展 2 | 3 | ## 扩展说明 4 | 5 | 从多个服务提者方中选择一个进行调用。 6 | 7 | ## 扩展接口 8 | 9 | * `com.alibaba.dubbo.rpc.cluster.RouterFactory` 10 | * `com.alibaba.dubbo.rpc.cluster.Router` 11 | 12 | ## 已知扩展 13 | 14 | * `com.alibaba.dubbo.rpc.cluster.router.ScriptRouterFactory` 15 | * `com.alibaba.dubbo.rpc.cluster.router.FileRouterFactory` 16 | 17 | ## 扩展示例 18 | 19 | Maven 项目结构: 20 | 21 | ``` 22 | src 23 | |-main 24 | |-java 25 | |-com 26 | |-xxx 27 | |-XxxRouterFactory.java (实现LoadBalance接口) 28 | |-resources 29 | |-META-INF 30 | |-dubbo 31 | |-com.alibaba.dubbo.rpc.cluster.RouterFactory (纯文本文件,内容为:xxx=com.xxx.XxxRouterFactory) 32 | 33 | ``` 34 | 35 | XxxRouterFactory.java: 36 | 37 | ```java 38 | package com.xxx; 39 | 40 | import com.alibaba.dubbo.rpc.cluster.RouterFactory; 41 | import com.alibaba.dubbo.rpc.Invoker; 42 | import com.alibaba.dubbo.rpc.Invocation; 43 | import com.alibaba.dubbo.rpc.RpcException; 44 | 45 | public class XxxRouterFactory implements RouterFactory { 46 | public List> select(List> invokers, Invocation invocation) throws RpcException { 47 | // ... 48 | } 49 | } 50 | ``` 51 | 52 | META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.RouterFactory: 53 | 54 | ```properties 55 | xxx=com.xxx.XxxRouterFactory 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/compiler.md: -------------------------------------------------------------------------------- 1 | # Compiler Extension 2 | 3 | ## Summary 4 | 5 | Java compiler, used for byte code dynamic generation for RPC invocation. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.common.compiler.Compiler` 10 | 11 | ## Extension Configuration 12 | 13 | No configuration required, the extension will be automatically discovered and loaded. 14 | 15 | ## Existing Extensions 16 | 17 | * `com.alibaba.dubbo.common.compiler.support.JdkCompiler` 18 | * `com.alibaba.dubbo.common.compiler.support.JavassistCompiler` 19 | 20 | ## Extension Guide 21 | 22 | Directory layout: 23 | 24 | ``` 25 | src 26 | |-main 27 | |-java 28 | |-com 29 | |-xxx 30 | |-XxxCompiler.java (Compiler implementation) 31 | |-resources 32 | |-META-INF 33 | |-dubbo 34 | |-com.alibaba.dubbo.common.compiler.Compiler (plain text file with the content: xxx=com.xxx.XxxCompiler) 35 | ``` 36 | 37 | XxxCompiler.java: 38 | 39 | ```java 40 | package com.xxx; 41 | 42 | import com.alibaba.dubbo.common.compiler.Compiler; 43 | 44 | public class XxxCompiler implements Compiler { 45 | public Object getExtension(Class type, String name) { 46 | // ... 47 | } 48 | } 49 | ``` 50 | 51 | META-INF/dubbo/com.alibaba.dubbo.common.compiler.Compiler: 52 | 53 | ```properties 54 | xxx=com.xxx.XxxCompiler 55 | ``` 56 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/graceful-shutdown.md: -------------------------------------------------------------------------------- 1 | # Graceful Shutdown 2 | 3 | Dubbo is graceful shutdown through the `ShutdownHook` of the JDK, so graceful shutdowns are not performed if you force shutdown the command, such as `kill -9 PID`, and will only be executed if `kill PID` is passed. 4 | 5 | ## Howto 6 | 7 | ### Service provider 8 | 9 | * When stop, first marked as not receiving new requests, the new request directly return the error, so that the client retries other machines. 10 | * Then check thread pool thread is running, if any, waiting for all threads to complete execution, unless overtime, then forced to close. 11 | 12 | ### Service consumer 13 | 14 | * When stop, No longer initiate a new request, all request on the client that got an error. 15 | * Then check the request has not returned the response, waiting for the response to return, unless overtime, then forced to close. 16 | 17 | ## Configuration shutdown wait time 18 | 19 | Set graceful shutdown timeout, the default timeout is 10 seconds, if the overtime is forced to close. 20 | 21 | ```properties 22 | # dubbo.properties 23 | dubbo.service.shutdown.wait=15000 24 | ``` 25 | 26 | If ShutdownHook does not take effect, you can call it yourself, **in tomcat, it is recommended by extending the ContextListener and call the following code for graceful shutdown**: 27 | 28 | ```java 29 | ProtocolConfig.destroyAll(); 30 | ``` 31 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/page.md: -------------------------------------------------------------------------------- 1 | # 页面扩展 2 | 3 | ## 扩展说明 4 | 5 | 对等网络节点组网器。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.container.page.PageHandler` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.container.page.pages.HomePageHandler` 22 | * `com.alibaba.dubbo.container.page.pages.StatusPageHandler` 23 | * `com.alibaba.dubbo.container.page.pages.LogPageHandler` 24 | * `com.alibaba.dubbo.container.page.pages.SystemPageHandler` 25 | 26 | ## 扩展示例 27 | 28 | Maven 项目结构: 29 | 30 | ``` 31 | src 32 | |-main 33 | |-java 34 | |-com 35 | |-xxx 36 | |-XxxPageHandler.java (实现PageHandler接口) 37 | |-resources 38 | |-META-INF 39 | |-dubbo 40 | |-com.alibaba.dubbo.container.page.PageHandler (纯文本文件,内容为:xxx=com.xxx.XxxPageHandler) 41 | ``` 42 | 43 | XxxPageHandler.java: 44 | 45 | ```java 46 | package com.xxx; 47 | 48 | import com.alibaba.dubbo.container.page.PageHandler; 49 | 50 | public class XxxPageHandler implements PageHandler { 51 | public Group lookup(URL url) { 52 | // ... 53 | } 54 | } 55 | ``` 56 | 57 | META-INF/dubbo/com.alibaba.dubbo.container.page.PageHandler: 58 | 59 | ```properties 60 | xxx=com.xxx.XxxPageHandler 61 | ``` 62 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/hostname-binding.md: -------------------------------------------------------------------------------- 1 | # Hostname Binding 2 | 3 | ## Lookup order 4 | 5 | Default host IP lookup order: 6 | 7 | * Get local address via `LocalHost.getLocalHost()`. 8 | * If it is `127. *` loopback address, then scan the network for host IP 9 | 10 | ## Host configuration 11 | 12 | Registered address if it is not correct, such as the need to register public address, you can do this: 13 | 14 | 1. edit `/etc/hosts` : add machinename and public ip, such as: 15 | 16 | ``` 17 | test1 205.182.23.201 18 | ``` 19 | 20 | 2. in `dubbo.xml` add host address configuration: 21 | 22 | ```xml 23 | 24 | ``` 25 | 26 | 3. or config that in `dubbo.properties`: 27 | 28 | ```properties 29 | dubbo.protocol.host=205.182.23.201 30 | ``` 31 | 32 | ## Port configuration 33 | 34 | The default port and protocol: 35 | 36 | Protocol | Port 37 | ------------- | ------------- 38 | dubbo | 20880 39 | rmi | 1099 40 | http | 80 41 | hessian | 80 42 | webservice | 80 43 | memcached | 11211 44 | redis | 6379 45 | 46 | You can configure the port as follows: 47 | 48 | 1. in `dubbo.xml` add port configuration: 49 | 50 | ```xml 51 | 52 | ``` 53 | 54 | 2. or config that in `dubbo.properties`: 55 | 56 | ```properties 57 | dubbo.protocol.dubbo.port=20880 58 | ``` 59 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/reference-config-cache.md: -------------------------------------------------------------------------------- 1 | # ReferenceConfig 缓存 2 | 3 | `ReferenceConfig` 实例很重,封装了与注册中心的连接以及与提供者的连接,需要缓存。否则重复生成 `ReferenceConfig` 可能造成性能问题并且会有内存和连接泄漏。在 API 方式编程时,容易忽略此问题。 4 | 5 | 因此,自 `2.4.0` 版本开始, dubbo 提供了简单的工具类 `ReferenceConfigCache`用于缓存 `ReferenceConfig` 实例。 6 | 7 | 使用方式如下: 8 | 9 | ```java 10 | ReferenceConfig reference = new ReferenceConfig(); 11 | reference.setInterface(XxxService.class); 12 | reference.setVersion("1.0.0"); 13 | ...... 14 | ReferenceConfigCache cache = ReferenceConfigCache.getCache(); 15 | // cache.get方法中会缓存 Reference对象,并且调用ReferenceConfig.get方法启动ReferenceConfig 16 | XxxService xxxService = cache.get(reference); 17 | // 注意! Cache会持有ReferenceConfig,不要在外部再调用ReferenceConfig的destroy方法,导致Cache内的ReferenceConfig失效! 18 | // 使用xxxService对象 19 | xxxService.sayHello(); 20 | ``` 21 | 22 | 消除 Cache 中的 `ReferenceConfig`,将销毁 `ReferenceConfig` 并释放对应的资源。 23 | 24 | ```java 25 | ReferenceConfigCache cache = ReferenceConfigCache.getCache(); 26 | cache.destroy(reference); 27 | ``` 28 | 29 | 缺省 `ReferenceConfigCache` 把相同服务 Group、接口、版本的 `ReferenceConfig` 认为是相同,缓存一份。即以服务 Group、接口、版本为缓存的 Key。 30 | 31 | 可以修改这个策略,在 `ReferenceConfigCache.getCache` 时,传一个 `KeyGenerator`。详见 `ReferenceConfigCache` 类的方法。 32 | 33 | ```java 34 | KeyGenerator keyGenerator = new ... 35 | ReferenceConfigCache cache = ReferenceConfigCache.getCache(keyGenerator ); 36 | ``` 37 | 38 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/multi-versions.md: -------------------------------------------------------------------------------- 1 | # Multi versions 2 | 3 | When an interface to achieve an incompatible upgrade, you can use the version number transition. Different versions of the services do not reference each other. 4 | 5 | You can follow the steps below for version migration: 6 | 7 | 0. In the low pressure period, upgrade to half of the provider to the new version 8 | 0. Then upgrade all consumers to the new version 9 | 0. Then upgrade the remaining half providers to the new version 10 | 11 | 12 | Old version of the service provider configuration: 13 | 14 | ```xml 15 | 16 | ``` 17 | 18 | New version of the service provider configuration: 19 | 20 | ```xml 21 | 22 | ``` 23 | 24 | Old version of the service consumer configuration: 25 | 26 | ```xml 27 | 28 | ``` 29 | 30 | New version of the service consumer configuration: 31 | 32 | ```xml 33 | 34 | ``` 35 | 36 | If you do not need to distinguish between versions, can be configured as follows [^1]: 37 | 38 | ```xml 39 | 40 | ``` 41 | 42 | [^1]: `2.2.0` or later support 43 | -------------------------------------------------------------------------------- /dubbo-user-book/references/protocol/redis.md: -------------------------------------------------------------------------------- 1 | # redis:// 2 | 3 | 基于 Redis [^1] 实现的 RPC 协议 [^2]。 4 | 5 | ## 注册 redis 服务的地址 6 | 7 | ```java 8 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 9 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 10 | registry.register(URL.valueOf("redis://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo&group=member&loadbalance=consistenthash")); 11 | ``` 12 | 13 | ## 在客户端引用 14 | 15 | 在客户端使用 [^3]: 16 | 17 | ```xml 18 | 19 | ``` 20 | 21 | 或者,点对点直连: 22 | 23 | ```xml 24 | 25 | ``` 26 | 27 | 也可以使用自定义接口: 28 | 29 | ```xml 30 | 31 | ``` 32 | 33 | 方法名建议和 redis 的标准方法名相同,即:get(key), set(key, value), delet(key)。 34 | 35 | 如果方法名和 redis 的标准方法名不相同,则需要配置映射关系 [^4]: 36 | 37 | ```xml 38 | 39 | ``` 40 | 41 | [^1]: [Redis](http://redis.io) 是一个高效的 KV 存储服务器 42 | [^2]: `2.3.0` 以上版本支持 43 | [^3]: 不需要感知 Redis 的地址 44 | [^4]: 其中 "p:xxx" 为 spring 的标准 p 标签 45 | -------------------------------------------------------------------------------- /dubbo-user-book-en/references/xml/introduction.md: -------------------------------------------------------------------------------- 1 | # schema configuration reference 2 | 3 | The following pages show all the configuration properties [^2] with XML Config [^1] as an example. For other configurations, please reference: [Properties Configuration](../../configuration/properties.md), [Annotation Configuration](../../configuration/annotation.md), [API Configuration](../../configuration/api.md). 4 | 5 | All configuration properties fall into three categories, see the "Function" in the table below. 6 | 7 | * Service discovery: used for service registration and discovery in order to find providers for consumers. 8 | * Service governance: used for service management and governance, such as to provide conveninence for dev or test. 9 | * Performance optinize: used for optimizing performance. Diffenent properties may has different performance impact. 10 | * All properties will transform into URL [^3] which is generated by provider. The url will be subscribed by consumers through registry. Please see the `Corresponding URL parameter` in the table below for each property. 11 | 12 | 13 | [^1]: XML Schema: http://dubbo.apache.org/schema/dubbo/dubbo.xsd 14 | [^2]: Notice: These three properties, group, interface, and version determine a service. All other properties are used for service governance or performance optimize. 15 | [^3]: URL format:`protocol://username:password@host:port/path?key=value&key=value` 16 | 17 | -------------------------------------------------------------------------------- /dubbo-admin-book-en/install/redis.md: -------------------------------------------------------------------------------- 1 | # install Redis register center 2 | 3 | 4 | 5 | Redis [^1] introductions, please refer to: [Redis application center manual](../../dubbo-user-book-en/references/registry/redis.md)。 6 | 7 | you need an origin Redis server only, and change the value from `dubbo.registry.addrss` to `redis://127.0.0.1:6379` in `conf/dubbo.properties` of [quick start](../../dubbo-user-book-en/quick-start.md) 8 | 9 | Redis configuration center cluster [^2] write multiple server in client side and read from a single server. 10 | 11 | Install: 12 | 13 | ```sh 14 | wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/redis/redis-2.4.8.tar.gz 15 | tar xzf redis-2.4.8.tar.gz 16 | cd redis-2.4.8 17 | make 18 | ``` 19 | 20 | Configuration: 21 | 22 | ```sh 23 | vi redis.conf 24 | ``` 25 | 26 | Start: 27 | 28 | ```sh 29 | nohup ./src/redis-server redis.conf & 30 | ``` 31 | 32 | Stop: 33 | 34 | ```sh 35 | killall redis-server 36 | ``` 37 | 38 | * Command line [^3]: 39 | 40 | ```sh 41 | ./src/redis-cli 42 | hgetall /dubbo/com.foo.BarService/providers 43 | ``` 44 | 45 | Or: 46 | 47 | ```sh 48 | telnet 127.0.0.1 6379 49 | hgetall /dubbo/com.foo.BarService/providers 50 | ``` 51 | 52 | [^1]: Redis is a high performance KV store server, please refer to: http://redis.io/topics/quickstart 53 | [^2]: Support for version `2.1.0` and higher 54 | [^3]: Please refer to: http://redis.io/commands -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/container.md: -------------------------------------------------------------------------------- 1 | # Container Extension 2 | 3 | ## Summary 4 | 5 | Service container extension, useful for loading custom contents. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.container.Container` 10 | 11 | ## Extension Configuration 12 | 13 | ```sh 14 | java com.alibaba.dubbo.container.Main spring jetty log4j 15 | ``` 16 | 17 | ## Existing Extensions 18 | 19 | * `com.alibaba.dubbo.container.spring.SpringContainer` 20 | * `com.alibaba.dubbo.container.spring.JettyContainer` 21 | * `com.alibaba.dubbo.container.spring.Log4jContainer` 22 | 23 | ## Extension Guide 24 | 25 | Directory layout: 26 | 27 | ``` 28 | src 29 | |-main 30 | |-java 31 | |-com 32 | |-xxx 33 | |-XxxContainer.java (Container implementation) 34 | |-resources 35 | |-META-INF 36 | |-dubbo 37 | |-com.alibaba.dubbo.container.Container (plain text file with the content: xxx=com.xxx.XxxContainer) 38 | ``` 39 | 40 | XxxContainer.java: 41 | 42 | ```java 43 | package com.xxx; 44 | 45 | com.alibaba.dubbo.container.Container; 46 | 47 | 48 | public class XxxContainer implements Container { 49 | public Status start() { 50 | // ... 51 | } 52 | public Status stop() { 53 | // ... 54 | } 55 | } 56 | ``` 57 | 58 | META-INF/dubbo/com.alibaba.dubbo.container.Container: 59 | 60 | ```properties 61 | xxx=com.xxx.XxxContainer 62 | ``` 63 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/extension-factory.md: -------------------------------------------------------------------------------- 1 | # ExtensionFactory Extension 2 | 3 | ## Summary 4 | 5 | Factory to load dubbo extensions. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.common.extension.ExtensionFactory` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | ## Existing Extension 18 | 19 | * `com.alibaba.dubbo.common.extension.factory.SpiExtensionFactory` 20 | * `com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory` 21 | 22 | ## Extension Guide 23 | 24 | Directory layout: 25 | 26 | ``` 27 | src 28 | |-main 29 | |-java 30 | |-com 31 | |-xxx 32 | |-XxxExtensionFactory.java (ExtensionFactory implementation) 33 | |-resources 34 | |-META-INF 35 | |-dubbo 36 | |-com.alibaba.dubbo.common.extension.ExtensionFactory (plain text file with the content: xxx=com.xxx.XxxExtensionFactory) 37 | ``` 38 | 39 | XxxExtensionFactory.java: 40 | 41 | ```java 42 | package com.xxx; 43 | 44 | import com.alibaba.dubbo.common.extension.ExtensionFactory; 45 | 46 | public class XxxExtensionFactory implements ExtensionFactory { 47 | public Object getExtension(Class type, String name) { 48 | // ... 49 | } 50 | } 51 | ``` 52 | 53 | META-INF/dubbo/com.alibaba.dubbo.common.extension.ExtensionFactory: 54 | 55 | ```properties 56 | xxx=com.xxx.XxxExtensionFactory 57 | ``` 58 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/invoker-listener.md: -------------------------------------------------------------------------------- 1 | # 引用监听扩展 2 | 3 | ## 扩展说明 4 | 5 | 当有服务引用时,触发该事件。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.rpc.InvokerListener` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | 18 | ``` 19 | 20 | ## 已知扩展 21 | 22 | `com.alibaba.dubbo.rpc.listener.DeprecatedInvokerListener` 23 | 24 | ## 扩展示例 25 | 26 | Maven 项目结构: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxInvokerListener.java (实现InvokerListener接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.InvokerListener (纯文本文件,内容为:xxx=com.xxx.XxxInvokerListener) 39 | ``` 40 | 41 | XxxInvokerListener.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.InvokerListener; 47 | import com.alibaba.dubbo.rpc.Invoker; 48 | import com.alibaba.dubbo.rpc.RpcException; 49 | 50 | public class XxxInvokerListener implements InvokerListener { 51 | public void referred(Invoker invoker) throws RpcException { 52 | // ... 53 | } 54 | public void destroyed(Invoker invoker) throws RpcException { 55 | // ... 56 | } 57 | } 58 | ``` 59 | 60 | META-INF/dubbo/com.alibaba.dubbo.rpc.InvokerListener: 61 | 62 | ```properties 63 | xxx=com.xxx.XxxInvokerListener 64 | ``` 65 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/networker.md: -------------------------------------------------------------------------------- 1 | # Networker Extension 2 | 3 | ## Summary 4 | 5 | Extension for peer to peer network grouping. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.remoting.p2p.Networker` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extension 20 | 21 | * `com.alibaba.dubbo.remoting.p2p.support.MulticastNetworker` 22 | * `com.alibaba.dubbo.remoting.p2p.support.FileNetworker` 23 | 24 | ## Extension Guide 25 | 26 | Directory layout: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxNetworker.java (Networker implementation) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.remoting.p2p.Networker (plain text file with the content: xxx=com.xxx.XxxNetworker) 39 | ``` 40 | 41 | XxxNetworker.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.remoting.p2p.Networker; 47 | 48 | public class XxxNetworker implements Networker { 49 | public Group lookup(URL url) { 50 | // ... 51 | } 52 | } 53 | ``` 54 | 55 | META-INF/dubbo/com.alibaba.dubbo.remoting.p2p.Networker: 56 | 57 | ```properties 58 | xxx=com.xxx.XxxNetworker 59 | ``` 60 | -------------------------------------------------------------------------------- /dubbo-user-book/configuration/properties.md: -------------------------------------------------------------------------------- 1 | # 属性配置 2 | 3 | 如果公共配置很简单,没有多注册中心,多协议等情况,或者想多个 Spring 容器想共享配置,可以使用 dubbo.properties 作为缺省配置。 4 | 5 | Dubbo 将自动加载 classpath 根目录下的 dubbo.properties,可以通过JVM启动参数 `-Ddubbo.properties.file=xxx.properties` 改变缺省配置位置。[^1] 6 | 7 | 8 | 9 | ## 映射规则 10 | 11 | 将 XML 配置的标签名,加属性名,用点分隔,多个属性拆成多行 12 | 13 | * 比如:`dubbo.application.name=foo`等价于`` 14 | * 比如:`dubbo.registry.address=10.20.153.10:9090`等价于` ` 15 | 16 | 17 | 如果 XML 有多行同名标签配置,可用 id 号区分,如果没有 id 号将对所有同名标签生效 18 | 19 | * 比如:`dubbo.protocol.rmi.port=1234`等价于` ` [^2] 20 | * 比如:`dubbo.registry.china.address=10.20.153.10:9090`等价于`` 21 | 22 | 下面是 dubbo.properties 的一个典型配置: 23 | 24 | ```properties 25 | dubbo.application.name=foo 26 | dubbo.application.owner=bar 27 | dubbo.registry.address=10.20.153.10:9090 28 | ``` 29 | 30 | ## 覆盖策略 31 | 32 | ![properties-override](../sources/images/dubbo-properties-override.jpg) 33 | 34 | JVM 启动 -D 参数优先,这样可以使用户在部署和启动时进行参数重写,比如在启动时需改变协议的端口。 35 | 36 | XML 次之,如果在 XML 中有配置,则 dubbo.properties 中的相应配置项无效。 37 | 38 | Properties 最后,相当于缺省值,只有 XML 没有配置时,dubbo.properties 的相应配置项才会生效,通常用于共享公共配置,比如应用名。 39 | 40 | 41 | [^1]: 如果 classpath 根目录下存在多个 dubbo.properties,比如多个 jar 包中有 dubbo.properties,Dubbo 会任意加载,并打印 Error 日志,后续可能改为抛异常。 42 | [^2]: 协议的 id 没配时,缺省使用协议名作为 id 43 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/preflight-check.md: -------------------------------------------------------------------------------- 1 | # 启动时检查 2 | 3 | Dubbo 缺省会在启动时检查依赖的服务是否可用,不可用时会抛出异常,阻止 Spring 初始化完成,以便上线时,能及早发现问题,默认 `check="true"`。 4 | 5 | 可以通过 `check="false"` 关闭检查,比如,测试时,有些服务不关心,或者出现了循环依赖,必须有一方先启动。 6 | 7 | 另外,如果你的 Spring 容器是懒加载的,或者通过 API 编程延迟引用服务,请关闭 check,否则服务临时不可用时,会抛出异常,拿到 null 引用,如果 `check="false"`,总是会返回引用,当服务恢复时,能自动连上。 8 | 9 | ## 示例 10 | 11 | ### 通过 spring 配置文件 12 | 13 | 关闭某个服务的启动时检查 (没有提供者时报错): 14 | 15 | ```xml 16 | 17 | ``` 18 | 19 | 关闭所有服务的启动时检查 (没有提供者时报错): 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | 关闭注册中心启动时检查 (注册订阅失败时报错): 26 | 27 | ```xml 28 | 29 | ``` 30 | 31 | ### 通过 dubbo.properties 32 | 33 | ```properties 34 | dubbo.reference.com.foo.BarService.check=false 35 | dubbo.reference.check=false 36 | dubbo.consumer.check=false 37 | dubbo.registry.check=false 38 | ``` 39 | 40 | ### 通过 -D 参数 41 | 42 | ```sh 43 | java -Ddubbo.reference.com.foo.BarService.check=false 44 | java -Ddubbo.reference.check=false 45 | java -Ddubbo.consumer.check=false 46 | java -Ddubbo.registry.check=false 47 | ``` 48 | 49 | ## 配置的含义 50 | 51 | `dubbo.reference.check=false`,强制改变所有 reference 的 check 值,就算配置中有声明,也会被覆盖。 52 | 53 | `dubbo.consumer.check=false`,是设置 check 的缺省值,如果配置中有显式的声明,如:``,不会受影响。 54 | 55 | `dubbo.registry.check=false`,前面两个都是指订阅成功,但提供者列表是否为空是否报错,如果注册订阅失败时,也允许启动,需使用此选项,将在后台定时重试。 56 | -------------------------------------------------------------------------------- /dubbo-user-book/references/protocol/memcached.md: -------------------------------------------------------------------------------- 1 | # memcached:// 2 | 3 | 基于 memcached [^1] 实现的 RPC 协议 [^2]。 4 | 5 | ## 注册 memcached 服务的地址 6 | 7 | ```java 8 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 9 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 10 | registry.register(URL.valueOf("memcached://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo&group=member&loadbalance=consistenthash")); 11 | ``` 12 | 13 | ## 在客户端引用 14 | 15 | 在客户端使用 [^3]: 16 | 17 | ```xml 18 | 19 | ``` 20 | 21 | 或者,点对点直连: 22 | 23 | ```xml 24 | 25 | ``` 26 | 27 | 也可以使用自定义接口: 28 | 29 | ```xml 30 | 31 | ``` 32 | 33 | 方法名建议和 memcached 的标准方法名相同,即:get(key), set(key, value), delete(key)。 34 | 35 | 如果方法名和 memcached 的标准方法名不相同,则需要配置映射关系 [^4]: 36 | 37 | ```xml 38 | 39 | ``` 40 | 41 | [^1]: [Memcached](http://memcached.org/) 是一个高效的 KV 缓存服务器 42 | [^2]: `2.3.0` 以上版本支持 43 | [^3]: 不需要感知 Memcached 的地址 44 | [^4]: 其中 "p:xxx" 为 spring 的标准 p 标签 -------------------------------------------------------------------------------- /dubbo-user-book-en/preface/usage.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | ## Spring configuration of local service 4 | 5 | local.xml: 6 | 7 | ```xml 8 | 9 | 10 | 11 | 12 | ``` 13 | 14 | ## Spring configuration of remote service 15 | 16 | The remote configuration can be done by very little change based on the local configuration: 17 | 18 | * split the `local.xml` into two part, put the service define part into `remote-privider.xml`(exists in the provider node), meanwhile the refrence part into `remote-consumer.xml`(exists in the consumer node). 19 | * add `` to the provider's configuration, and `` to the consumer's configuration. 20 | 21 | remote-provider.xml: 22 | 23 | ```xml 24 | 25 | 26 | 27 | 28 | ``` 29 | 30 | remote-consumer.xml: 31 | 32 | ```xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | ``` 40 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/context.md: -------------------------------------------------------------------------------- 1 | # 上下文信息 2 | 3 | 上下文中存放的是当前调用过程中所需的环境信息。所有配置信息都将转换为 URL 的参数,参见 [schema 配置参考手册](../references/xml/introduction.md) 中的**对应URL参数**一列。 4 | 5 | RpcContext 是一个 ThreadLocal 的临时状态记录器,当接收到 RPC 请求,或发起 RPC 请求时,RpcContext 的状态都会变化。比如:A 调 B,B 再调 C,则 B 机器上,在 B 调 C 之前,RpcContext 记录的是 A 调 B 的信息,在 B 调 C 之后,RpcContext 记录的是 B 调 C 的信息。 6 | 7 | ## 服务消费方 8 | 9 | ```java 10 | // 远程调用 11 | xxxService.xxx(); 12 | // 本端是否为消费端,这里会返回true 13 | boolean isConsumerSide = RpcContext.getContext().isConsumerSide(); 14 | // 获取最后一次调用的提供方IP地址 15 | String serverIP = RpcContext.getContext().getRemoteHost(); 16 | // 获取当前服务配置信息,所有配置信息都将转换为URL的参数 17 | String application = RpcContext.getContext().getUrl().getParameter("application"); 18 | // 注意:每发起RPC调用,上下文状态会变化 19 | yyyService.yyy(); 20 | ``` 21 | 22 | ## 服务提供方 23 | 24 | ```java 25 | public class XxxServiceImpl implements XxxService { 26 | 27 | public void xxx() { 28 | // 本端是否为提供端,这里会返回true 29 | boolean isProviderSide = RpcContext.getContext().isProviderSide(); 30 | // 获取调用方IP地址 31 | String clientIP = RpcContext.getContext().getRemoteHost(); 32 | // 获取当前服务配置信息,所有配置信息都将转换为URL的参数 33 | String application = RpcContext.getContext().getUrl().getParameter("application"); 34 | // 注意:每发起RPC调用,上下文状态会变化 35 | yyyService.yyy(); 36 | // 此时本端变成消费端,这里会返回false 37 | boolean isProviderSide = RpcContext.getContext().isProviderSide(); 38 | } 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/delay-publish.md: -------------------------------------------------------------------------------- 1 | # 延迟暴露 2 | 3 | 如果你的服务需要预热时间,比如初始化缓存,等待相关资源就位等,可以使用 delay 进行延迟暴露。 4 | 5 | ## 延迟 5 秒暴露服务 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | ## 延迟到 Spring 初始化完成后,再暴露服务 [^1] 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | ### Spring 2.x 初始化死锁问题 18 | 19 | #### 触发条件 20 | 21 | 在 Spring 解析到 `` 时,就已经向外暴露了服务,而 Spring 还在接着初始化其它 Bean。如果这时有请求进来,并且服务的实现类里有调用 `applicationContext.getBean()` 的用法。 22 | 23 | 1. 请求线程的 applicationContext.getBean() 调用,先同步 singletonObjects 判断 Bean 是否存在,不存在就同步 beanDefinitionMap 进行初始化,并再次同步 singletonObjects 写入 Bean 实例缓存。 24 | 25 | ![deadlock](../sources/images/lock-get-bean.jpg) 26 | 27 | 2. 而 Spring 初始化线程,因不需要判断 Bean 的存在,直接同步 beanDefinitionMap 进行初始化,并同步 singletonObjects 写入 Bean 实例缓存。 28 | 29 | ![/user-guide/images/lock-init-context.jpg](../sources/images/lock-init-context.jpg) 30 | 31 | 这样就导致 getBean 线程,先锁 singletonObjects,再锁 beanDefinitionMap,再次锁 singletonObjects。 32 | 而 Spring 初始化线程,先锁 beanDefinitionMap,再锁 singletonObjects。反向锁导致线程死锁,不能提供服务,启动不了。 33 | 34 | #### 规避办法 35 | 36 | 1. 强烈建议不要在服务的实现类中有 applicationContext.getBean() 的调用,全部采用 IoC 注入的方式使用 Spring的Bean。 37 | 2. 如果实在要调 getBean(),可以将 Dubbo 的配置放在 Spring 的最后加载。 38 | 3. 如果不想依赖配置顺序,可以使用 ``,使 Dubbo 在 Spring 容器初始化完后,再暴露服务。 39 | 4. 如果大量使用 getBean(),相当于已经把 Spring 退化为工厂模式在用,可以将 Dubbo 的服务隔离单独的 Spring 容器。 40 | 41 | [^1]: 基于 Spring 的 ContextRefreshedEvent 事件触发暴露 42 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/exporter-listener.md: -------------------------------------------------------------------------------- 1 | # 暴露监听扩展 2 | 3 | ## 扩展说明 4 | 5 | 当有服务暴露时,触发该事件。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.rpc.ExporterListener` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | 18 | ``` 19 | 20 | ## 已知扩展 21 | 22 | `com.alibaba.dubbo.registry.directory.RegistryExporterListener` 23 | 24 | ## 扩展示例 25 | 26 | Maven 项目结构: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxExporterListener.java (实现ExporterListener接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.ExporterListener (纯文本文件,内容为:xxx=com.xxx.XxxExporterListener) 39 | ``` 40 | 41 | XxxExporterListener.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.ExporterListener; 47 | import com.alibaba.dubbo.rpc.Exporter; 48 | import com.alibaba.dubbo.rpc.RpcException; 49 | 50 | 51 | public class XxxExporterListener implements ExporterListener { 52 | public void exported(Exporter exporter) throws RpcException { 53 | // ... 54 | } 55 | public void unexported(Exporter exporter) throws RpcException { 56 | // ... 57 | } 58 | } 59 | ``` 60 | 61 | META-INF/dubbo/com.alibaba.dubbo.rpc.ExporterListener: 62 | 63 | ```properties 64 | xxx=com.xxx.XxxExporterListener 65 | ``` 66 | 67 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/proxy-factory.md: -------------------------------------------------------------------------------- 1 | # 动态代理扩展 2 | 3 | ## 扩展说明 4 | 5 | 将 `Invoker` 接口转换成业务接口。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.rpc.ProxyFactory` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.rpc.proxy.JdkProxyFactory` 22 | * `com.alibaba.dubbo.rpc.proxy.JavassistProxyFactory` 23 | 24 | ## 扩展示例 25 | 26 | Maven 项目结构: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxProxyFactory.java (实现ProxyFactory接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.ProxyFactory (纯文本文件,内容为:xxx=com.xxx.XxxProxyFactory) 39 | ``` 40 | 41 | XxxProxyFactory.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.ProxyFactory; 47 | import com.alibaba.dubbo.rpc.Invoker; 48 | import com.alibaba.dubbo.rpc.RpcException; 49 | 50 | 51 | public class XxxProxyFactory implements ProxyFactory { 52 | public T getProxy(Invoker invoker) throws RpcException { 53 | // ... 54 | } 55 | public Invoker getInvoker(T proxy, Class type, URL url) throws RpcException { 56 | // ... 57 | } 58 | } 59 | ``` 60 | 61 | META-INF/dubbo/com.alibaba.dubbo.rpc.ProxyFactory: 62 | 63 | ```properties 64 | xxx=com.xxx.XxxProxyFactory 65 | ``` 66 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/group-merger.md: -------------------------------------------------------------------------------- 1 | # 分组聚合 2 | 3 | 按组合并返回结果 [^1],比如菜单服务,接口一样,但有多种实现,用group区分,现在消费方需从每种group中调用一次返回结果,合并结果返回,这样就可以实现聚合菜单项。 4 | 5 | 相关代码可以参考 [dubbo 项目中的示例](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-merge) 6 | 7 | ## 配置 8 | 9 | 搜索所有分组 10 | 11 | ```xml 12 | 13 | ``` 14 | 15 | 合并指定分组 16 | 17 | ```xml 18 | 19 | ``` 20 | 21 | 指定方法合并结果,其它未指定的方法,将只调用一个 Group 22 | 23 | ```xml 24 | 25 | 26 | 27 | ``` 28 | 29 | 某个方法不合并结果,其它都合并结果 30 | 31 | ```xml 32 | 33 | 34 | 35 | ``` 36 | 37 | 指定合并策略,缺省根据返回值类型自动匹配,如果同一类型有两个合并器时,需指定合并器的名称 [^2] 38 | 39 | ```xml 40 | 41 | 42 | 43 | ``` 44 | 45 | 指定合并方法,将调用返回结果的指定方法进行合并,合并方法的参数类型必须是返回结果类型本身 46 | 47 | ```xml 48 | 49 | 50 | 51 | ``` 52 | 53 | [^1]: 从 `2.1.0` 版本开始支持 54 | [^2]: 参见:[合并结果扩展](../../dubbo-dev-book/impls/merger.md) 55 | -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/token-authorization.md: -------------------------------------------------------------------------------- 1 | # Token Authorization 2 | 3 | 4 | Through the token authorization control center at the registry to decide whether to issue tokens to consumers, you can prevent consumers from bypassing the registry access provider, another through the registry can flexibly change the authorization without modification or upgrade provider 5 | 6 | 7 | ![/user-guide/images/dubbo-token.jpg](../sources/images/dubbo-token.jpg) 8 | 9 | You can turn on token authentication globally: 10 | 11 | ```xml 12 | 13 | 14 | ``` 15 | or 16 | 17 | ```xml 18 | 19 | 20 | ``` 21 | 22 | Of course can turn on token authentication at service level: 23 | 24 | ```xml 25 | 26 | 27 | ``` 28 | or 29 | 30 | ```xml 31 | 32 | 33 | ``` 34 | 35 | Also can turn on token authentication at protocol level: 36 | 37 | ```xml 38 | 39 | 40 | ``` 41 | or 42 | 43 | ```xml 44 | 45 | 46 | ``` 47 | -------------------------------------------------------------------------------- /dubbo-user-book-en/references/protocol/redis.md: -------------------------------------------------------------------------------- 1 | # redis:// 2 | 3 | RPC protocol based on memcached implementation. 4 | 5 | ## Register redis service address 6 | 7 | ```java 8 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 9 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 10 | registry.register(URL.valueOf("redis://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo&group=member&loadbalance=consistenthash")); 11 | ``` 12 | 13 | ## Use in client 14 | 15 | get service reference: 16 | 17 | ```xml 18 | 19 | ``` 20 | 21 | or direct access by IP: 22 | 23 | 24 | ```xml 25 | 26 | ``` 27 | 28 | you can also use a custom interface: 29 | 30 | ```xml 31 | 32 | ``` 33 | 34 | The method name is the same as the standard method name of memcached, just like get(key), set(key, value), delete(key)。 35 | 36 | If the method name and the memcached standard method name are not the same, you need to configure the mapping 37 | 38 | ```xml 39 | 40 | ``` 41 | 42 | 43 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/router.md: -------------------------------------------------------------------------------- 1 | # Router Extension 2 | 3 | ## Summary 4 | 5 | Pick one from service providers and fire the invocation. 6 | 7 | ## Extension Interface 8 | 9 | * `com.alibaba.dubbo.rpc.cluster.RouterFactory` 10 | * `com.alibaba.dubbo.rpc.cluster.Router` 11 | 12 | ## Existing Extension 13 | 14 | * `com.alibaba.dubbo.rpc.cluster.router.ScriptRouterFactory` 15 | * `com.alibaba.dubbo.rpc.cluster.router.FileRouterFactory` 16 | 17 | ## Extension Guide 18 | 19 | Directory layout: 20 | 21 | ``` 22 | src 23 | |-main 24 | |-java 25 | |-com 26 | |-xxx 27 | |-XxxRouterFactory.java (LoadBalance implementation) 28 | |-resources 29 | |-META-INF 30 | |-dubbo 31 | |-com.alibaba.dubbo.rpc.cluster.RouterFactory (plain text file with the content: xxx=com.xxx.XxxRouterFactory) 32 | 33 | ``` 34 | 35 | XxxRouterFactory.java: 36 | 37 | ```java 38 | package com.xxx; 39 | 40 | import com.alibaba.dubbo.rpc.cluster.RouterFactory; 41 | import com.alibaba.dubbo.rpc.Invoker; 42 | import com.alibaba.dubbo.rpc.Invocation; 43 | import com.alibaba.dubbo.rpc.RpcException; 44 | 45 | public class XxxRouterFactory implements RouterFactory { 46 | public List> select(List> invokers, Invocation invocation) throws RpcException { 47 | // ... 48 | } 49 | } 50 | ``` 51 | 52 | META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.RouterFactory: 53 | 54 | ```properties 55 | xxx=com.xxx.XxxRouterFactory 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /dubbo-user-book-en/references/protocol/memcached.md: -------------------------------------------------------------------------------- 1 | # memcached:// 2 | 3 | RPC protocol based on memcached implementation. 4 | 5 | ## Register memcached service address 6 | 7 | ```java 8 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 9 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 10 | registry.register(URL.valueOf("memcached://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo&group=member&loadbalance=consistenthash")); 11 | ``` 12 | 13 | ## Use in client 14 | 15 | get service reference: 16 | 17 | ```xml 18 | 19 | ``` 20 | 21 | or direct access by IP: 22 | 23 | ```xml 24 | 25 | ``` 26 | 27 | you can also use a custom interface: 28 | 29 | ```xml 30 | 31 | ``` 32 | 33 | 34 | The method name is the same as the standard method name of memcached, just like get(key), set(key, value), delete(key)。 35 | 36 | If the method name and the memcached standard method name are not the same, you need to configure the mapping 37 | 38 | ```xml 39 | 40 | ``` 41 | 42 | 43 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/loadbalance.md: -------------------------------------------------------------------------------- 1 | # 负载均衡 2 | 3 | 在集群负载均衡时,Dubbo 提供了多种均衡策略,缺省为 `random` 随机调用。 4 | 5 | 可以自行扩展负载均衡策略,参见:[负载均衡扩展](../../dubbo-dev-book/impls/load-balance.md) 6 | 7 | ## 负载均衡策略 8 | 9 | ### Random LoadBalance 10 | 11 | * **随机**,按权重设置随机概率。 12 | * 在一个截面上碰撞的概率高,但调用量越大分布越均匀,而且按概率使用权重后也比较均匀,有利于动态调整提供者权重。 13 | 14 | ### RoundRobin LoadBalance 15 | 16 | * **轮循**,按公约后的权重设置轮循比率。 17 | * 存在慢的提供者累积请求的问题,比如:第二台机器很慢,但没挂,当请求调到第二台时就卡在那,久而久之,所有请求都卡在调到第二台上。 18 | 19 | ### LeastActive LoadBalance 20 | 21 | * **最少活跃调用数**,相同活跃数的随机,活跃数指调用前后计数差。 22 | * 使慢的提供者收到更少请求,因为越慢的提供者的调用前后计数差会越大。 23 | 24 | ### ConsistentHash LoadBalance 25 | 26 | * **一致性 Hash**,相同参数的请求总是发到同一提供者。 27 | * 当某一台提供者挂时,原本发往该提供者的请求,基于虚拟节点,平摊到其它提供者,不会引起剧烈变动。 28 | * 算法参见:http://en.wikipedia.org/wiki/Consistent_hashing 29 | * 缺省只对第一个参数 Hash,如果要修改,请配置 `` 30 | * 缺省用 160 份虚拟节点,如果要修改,请配置 `` 31 | 32 | ## 配置 33 | 34 | ### 服务端服务级别 35 | 36 | ```xml 37 | 38 | ``` 39 | 40 | ### 客户端服务级别 41 | 42 | ```xml 43 | 44 | ``` 45 | 46 | ### 服务端方法级别 47 | 48 | ```xml 49 | 50 | 51 | 52 | ``` 53 | 54 | ### 客户端方法级别 55 | 56 | ```xml 57 | 58 | 59 | 60 | ``` 61 | -------------------------------------------------------------------------------- /dubbo-admin-book-en/install/simple-registry-center.md: -------------------------------------------------------------------------------- 1 | # install Simple configuration center 2 | 3 | Simple Registry has not been well tested, may have bug, cluster is not supported, not recommended to use in production environment 4 | 5 | Install: 6 | 7 | ```sh 8 | git clone https://github.com/apache/incubator-dubbo-ops 9 | cd incubator-dubbo-ops && mvn package 10 | cd dubbo-registry-simple/target && tar xvf dubbo-registry-simple-2.0.0-assembly.tar.gz 11 | cd dubbo-registry-simple-2.0.0 12 | ``` 13 | 14 | Configuration: 15 | 16 | ```sh 17 | vi conf/dubbo.properties 18 | ``` 19 | 20 | Start: 21 | 22 | ```sh 23 | ./assembly.bin/start.sh 24 | ``` 25 | 26 | Stop: 27 | 28 | ```sh 29 | ./assembly.bin/stop.sh 30 | ``` 31 | 32 | Restart: 33 | 34 | ```sh 35 | ./assembly.bin/restart.sh 36 | ``` 37 | 38 | Debug: 39 | 40 | ```sh 41 | ./assembly.bin/start.sh debug 42 | ``` 43 | 44 | System status: 45 | 46 | ```sh 47 | ./assembly.bin/dump.sh 48 | ``` 49 | 50 | General control entrance: 51 | ```sh 52 | ./assembly.bin/server.sh start 53 | ./assembly.bin/server.sh stop 54 | ./assembly.bin/server.sh restart 55 | ./assembly.bin/server.sh debug 56 | ./assembly.bin/server.sh dump 57 | ``` 58 | 59 | Stdout: 60 | 61 | ```sh 62 | tail -f logs/stdout.log 63 | ``` 64 | 65 | Command line [^1]: 66 | 67 | ```shell 68 | telnet 127.0.0.1 9090 69 | help 70 | ``` 71 | 72 | Or: 73 | 74 | ```sh 75 | echo status | nc -i 1 127.0.0.1 9090 76 | ``` 77 | 78 | [^1]: Please refer to [Telnet command manual](../../dubbo-user-book-en/references/telnet.md) 79 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/dispatcher.md: -------------------------------------------------------------------------------- 1 | # 消息派发扩展 2 | 3 | ## 扩展说明 4 | 5 | 通道信息派发器,用于指定线程池模型。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.remoting.Dispatcher` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.remoting.transport.dispatcher.all.AllDispatcher` 22 | * `com.alibaba.dubbo.remoting.transport.dispatcher.direct.DirectDispatcher` 23 | * `com.alibaba.dubbo.remoting.transport.dispatcher.message.MessageOnlyDispatcher` 24 | * `com.alibaba.dubbo.remoting.transport.dispatcher.execution.ExecutionDispatcher` 25 | * `com.alibaba.dubbo.remoting.transport.dispatcher.connection.ConnectionOrderedDispatcher` 26 | 27 | ## 扩展示例 28 | 29 | Maven 项目结构: 30 | 31 | ``` 32 | src 33 | |-main 34 | |-java 35 | |-com 36 | |-xxx 37 | |-XxxDispatcher.java (实现Dispatcher接口) 38 | |-resources 39 | |-META-INF 40 | |-dubbo 41 | |-com.alibaba.dubbo.remoting.Dispatcher (纯文本文件,内容为:xxx=com.xxx.XxxDispatcher) 42 | ``` 43 | 44 | XxxDispatcher.java: 45 | 46 | ```java 47 | package com.xxx; 48 | 49 | import com.alibaba.dubbo.remoting.Dispatcher; 50 | 51 | public class XxxDispatcher implements Dispatcher { 52 | public Group lookup(URL url) { 53 | // ... 54 | } 55 | } 56 | ``` 57 | 58 | META-INF/dubbo/com.alibaba.dubbo.remoting.Dispatcher: 59 | 60 | ```properties 61 | xxx=com.xxx.XxxDispatcher 62 | ``` 63 | -------------------------------------------------------------------------------- /dubbo-dev-book/build.md: -------------------------------------------------------------------------------- 1 | # 源码构建 2 | 3 | ## 代码签出 4 | 5 | 通过以下的这个命令签出最新的项目源码 [^1]: 6 | 7 | ```sh 8 | git clone https://github.com/apache/incubator-dubbo.git dubbo 9 | ``` 10 | 11 | ## 分支 12 | 13 | 我们使用 master 作为主干版本的开发,使用分支作为维护版本。可以通过 https://github.com/apache/incubator-dubbo/tags 来查看所有版本的标签。 14 | 15 | ## 构建 16 | 17 | Dubbo 使用 [maven](http://maven.apache.org) 作为构建工具。 18 | 19 | 要求 20 | 21 | * Java 1.5 以上的版本 22 | * Maven 2.2.1 或者以上的版本 23 | 24 | 构建之前需要配置以下的 `MAVEN_OPTS` 25 | 26 | ```sh 27 | export MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=512m 28 | ``` 29 | 30 | 使用以下命令做一次构建 31 | 32 | ```sh 33 | mvn clean install 34 | ``` 35 | 36 | 可以通过以下的构建命令来跳过单元测试 37 | 38 | ```sh 39 | mvn install -Dmaven.test.skip 40 | ``` 41 | 42 | ## 构建源代码 jar 包 43 | 44 | 通过以下命令以构建 Dubbo 的源代码 jar 包,方便用来调试 Dubbo 源代码 45 | 46 | ```sh 47 | mvn clean source:jar install -Dmaven.test.skip 48 | ``` 49 | 50 | ## IDE 支持 51 | 52 | 使用以下命令来生成 IDE 的工程 53 | 54 | ### Intellij Idea 55 | 56 | ```sh 57 | mvn idea:idea 58 | ``` 59 | 60 | ### eclipse 61 | 62 | ```sh 63 | mvn eclipse:eclipse 64 | ``` 65 | 66 | 在 eclipse 中导入 67 | 68 | 首先,需要在 eclipse 中配置 maven 仓库。通过 Preferences -> Java -> Build Path -> Classpath 定义 `M2_REPO` 的 classpath 变量指向本地的 maven 仓库。 [^2] 69 | 70 | 71 | 也可以通过以下的 maven 命令配置: 72 | 73 | ```sh 74 | mvn eclipse:configure-workspace -Declipse.workspace=/path/to/the/workspace/ 75 | ``` 76 | 77 | [^1]: 也可以直接在 https://github.com/apache/incubator-dubbo 上浏览源代码 78 | [^2]: UNIX 下的路径是 ${HOME}/.m2/repository, Windows 下的路径是 C:\Documents and Settings\\.m2\repository 79 | 80 | -------------------------------------------------------------------------------- /dubbo-user-book/references/xml/dubbo-monitor.md: -------------------------------------------------------------------------------- 1 | 35 | 36 | 45 | # dubbo:monitor 46 | 47 | 监控中心配置。对应的配置类: `com.alibaba.dubbo.config.MonitorConfig` 48 | 49 | | 属性 | 对应URL参数 | 类型 | 是否必填 | 缺省值 | 作用 | 描述 | 兼容性 | 50 | | --- | --- | ---- | --- | --- | --- | --- | --- | 51 | | protocol | protocol | string | 可选 | dubbo | 服务治理 | 监控中心协议,如果为protocol="registry",表示从注册中心发现监控中心地址,否则直连监控中心。 | 2.0.9以上版本 | 52 | | address | <url> | string | 可选 | N/A | 服务治理 | 直连监控中心服务器地址,address="10.20.130.230:12080" | 1.0.16以上版本 | 53 | -------------------------------------------------------------------------------- /dubbo-user-book-en/benchmark-tool.md: -------------------------------------------------------------------------------- 1 | # Beanchmark testing tool installer 2 | 3 | * download: git clone https://github.com/apache/incubator-dubbo.git 4 | * compile benchmark: cd incubator-dubbo/dubbo-test/dubbo-test-benchmark; mvn clean install 5 | * uncompress benchmark: incubator-dubbo/dubbo-test/dubbo-test-benchmark/target/dubbo-test-benchmark-2.6.2-SNAPSHOT.tar.gz 6 | 7 | Read ReadMe.txt (the contents are as follows, in the compressed package.) 8 | 9 | * Build a new benchmark project, such as demo.benchmark 10 | 11 | * Import the your own interface api jar and dubbo.benchmark.jar (Unzip dubbo.benchmark.tar.gz, under the lib directory ) 12 | 13 | * Create a new class to implement AbstractClientRunnable 14 | 15 | * Implement the constructor of the parent class 16 | * Implement the invoke method and create a local interface proxy by serviceFactory,and finish your own business logic, as follows: 17 | 18 | ```java 19 | public Object invoke(ServiceFactory serviceFactory) { 20 | DemoService demoService = (DemoService) serviceFactory.get(DemoService.class); 21 | return demoService.sendRequest("hello"); 22 | } 23 | ``` 24 | 25 | * Make your own benchmark project into a jar package, such as demo.benchmark.jar 26 | 27 | * Put the demo.benchmark.jar and service API jar into directory dubbo.benchmark/lib 28 | 29 | * Configuring duubo.properties 30 | 31 | * Run run.bat(windows) or run.sh(linux) 32 | 33 | If you want to test the different versions of Dubbo, you can replace the jar of the Dubbo. 34 | 35 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/service-container.md: -------------------------------------------------------------------------------- 1 | # 服务容器 2 | 3 | 服务容器是一个 standalone 的启动程序,因为后台服务不需要 Tomcat 或 JBoss 等 Web 容器的功能,如果硬要用 Web 容器去加载服务提供方,增加复杂性,也浪费资源。 4 | 5 | 服务容器只是一个简单的 Main 方法,并加载一个简单的 Spring 容器,用于暴露服务。 6 | 7 | 服务容器的加载内容可以扩展,内置了 spring, jetty, log4j 等加载,可通过[容器扩展点](../../dubbo-dev-book/impls/container.md)进行扩展。配置配在 java 命令的 -D 参数或者 `dubbo.properties` 中。 8 | 9 | ## 容器类型 10 | 11 | ### Spring Container 12 | 13 | * 自动加载 `META-INF/spring` 目录下的所有 Spring 配置。 14 | * 配置 spring 配置加载位置: 15 | 16 | ```properties 17 | dubbo.spring.config=classpath*:META-INF/spring/*.xml 18 | ``` 19 | 20 | ### Jetty Container 21 | 22 | * 启动一个内嵌 Jetty,用于汇报状态。 23 | * 配置: 24 | * `dubbo.jetty.port=8080`:配置 jetty 启动端口 25 | * `dubbo.jetty.directory=/foo/bar`:配置可通过 jetty 直接访问的目录,用于存放静态文件 26 | * `dubbo.jetty.page=log,status,system`:配置显示的页面,缺省加载所有页面 27 | 28 | 29 | ### Log4j Container 30 | 31 | * 自动配置 log4j 的配置,在多进程启动时,自动给日志文件按进程分目录。 32 | * 配置: 33 | * `dubbo.log4j.file=/foo/bar.log`:配置日志文件路径 34 | * `dubbo.log4j.level=WARN`:配置日志级别 35 | * `dubbo.log4j.subdirectory=20880`:配置日志子目录,用于多进程启动,避免冲突 36 | 37 | ## 容器启动 38 | 39 | 缺省只加载 spring 40 | 41 | ```sh 42 | java com.alibaba.dubbo.container.Main 43 | ``` 44 | 45 | 通过 main 函数参数传入要加载的容器 46 | 47 | ```sh 48 | java com.alibaba.dubbo.container.Main spring jetty log4j 49 | ``` 50 | 51 | 通过 JVM 启动参数传入要加载的容器 52 | 53 | ```sh 54 | java com.alibaba.dubbo.container.Main -Ddubbo.container=spring,jetty,log4j 55 | ``` 56 | 57 | 通过 classpath 下的 `dubbo.properties` 配置传入要加载的容器 58 | 59 | ``` 60 | dubbo.container=spring,jetty,log4j 61 | ``` 62 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/page.md: -------------------------------------------------------------------------------- 1 | # Page Extension 2 | 3 | ## Summary 4 | 5 | Extension for page handler 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.container.page.PageHandler` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extension 20 | 21 | * `com.alibaba.dubbo.container.page.pages.HomePageHandler` 22 | * `com.alibaba.dubbo.container.page.pages.StatusPageHandler` 23 | * `com.alibaba.dubbo.container.page.pages.LogPageHandler` 24 | * `com.alibaba.dubbo.container.page.pages.SystemPageHandler` 25 | 26 | ## Extension Guide 27 | 28 | Directory layout: 29 | 30 | ``` 31 | src 32 | |-main 33 | |-java 34 | |-com 35 | |-xxx 36 | |-XxxPageHandler.java (PageHandler implementation) 37 | |-resources 38 | |-META-INF 39 | |-dubbo 40 | |-com.alibaba.dubbo.container.page.PageHandler (plain text file with the content: xxx=com.xxx.XxxPageHandler) 41 | ``` 42 | 43 | XxxPageHandler.java: 44 | 45 | ```java 46 | package com.xxx; 47 | 48 | import com.alibaba.dubbo.container.page.PageHandler; 49 | 50 | public class XxxPageHandler implements PageHandler { 51 | public Group lookup(URL url) { 52 | // ... 53 | } 54 | } 55 | ``` 56 | 57 | META-INF/dubbo/com.alibaba.dubbo.container.page.PageHandler: 58 | 59 | ```properties 60 | xxx=com.xxx.XxxPageHandler 61 | ``` 62 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/load-balance.md: -------------------------------------------------------------------------------- 1 | # 负载均衡扩展 2 | 3 | ## 扩展说明 4 | 5 | 从多个服务提者方中选择一个进行调用 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.rpc.cluster.LoadBalance` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.rpc.cluster.loadbalance.RandomLoadBalance` 22 | * `com.alibaba.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance` 23 | * `com.alibaba.dubbo.rpc.cluster.loadbalance.LeastActiveLoadBalance` 24 | 25 | ## 扩展示例 26 | 27 | Maven 项目结构: 28 | 29 | ``` 30 | src 31 | |-main 32 | |-java 33 | |-com 34 | |-xxx 35 | |-XxxLoadBalance.java (实现LoadBalance接口) 36 | |-resources 37 | |-META-INF 38 | |-dubbo 39 | |-com.alibaba.dubbo.rpc.cluster.LoadBalance (纯文本文件,内容为:xxx=com.xxx.XxxLoadBalance) 40 | ``` 41 | 42 | XxxLoadBalance.java: 43 | 44 | ```java 45 | package com.xxx; 46 | 47 | import com.alibaba.dubbo.rpc.cluster.LoadBalance; 48 | import com.alibaba.dubbo.rpc.Invoker; 49 | import com.alibaba.dubbo.rpc.Invocation; 50 | import com.alibaba.dubbo.rpc.RpcException; 51 | 52 | public class XxxLoadBalance implements LoadBalance { 53 | public Invoker select(List> invokers, Invocation invocation) throws RpcException { 54 | // ... 55 | } 56 | } 57 | ``` 58 | 59 | META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.LoadBalance: 60 | 61 | ```properties 62 | xxx=com.xxx.XxxLoadBalance 63 | ``` 64 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/validation.md: -------------------------------------------------------------------------------- 1 | # 验证扩展 2 | 3 | ## 扩展说明 4 | 5 | 参数验证扩展点。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.validation.Validation` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | `com.alibaba.dubbo.validation.support.jvalidation.JValidation` 22 | 23 | ## 扩展示例 24 | 25 | Maven 项目结构: 26 | 27 | ``` 28 | src 29 | |-main 30 | |-java 31 | |-com 32 | |-xxx 33 | |-XxxValidation.java (实现Validation接口) 34 | |-resources 35 | |-META-INF 36 | |-dubbo 37 | |-com.alibaba.dubbo.validation.Validation (纯文本文件,内容为:xxx=com.xxx.XxxValidation) 38 | ``` 39 | 40 | XxxValidation.java: 41 | 42 | ```java 43 | package com.xxx; 44 | 45 | import com.alibaba.dubbo.validation.Validation; 46 | 47 | public class XxxValidation implements Validation { 48 | public Object getValidator(URL url) { 49 | // ... 50 | } 51 | } 52 | ``` 53 | 54 | XxxValidator.java: 55 | 56 | ```java 57 | package com.xxx; 58 | 59 | import com.alibaba.dubbo.validation.Validator; 60 | 61 | public class XxxValidator implements Validator { 62 | public XxxValidator(URL url) { 63 | // ... 64 | } 65 | public void validate(Invocation invocation) throws Exception { 66 | // ... 67 | } 68 | } 69 | ``` 70 | 71 | META-INF/dubbo/com.alibaba.dubbo.validation.Validation: 72 | 73 | ```properties 74 | xxx=com.xxx.XxxValidation 75 | ``` -------------------------------------------------------------------------------- /dubbo-admin-book-en/install/introduction.md: -------------------------------------------------------------------------------- 1 | # Install manual 2 | 3 | You can run Demo Provider and Demo Consumer only, the default discovery strategy is Multicast by configuration center broadcast, do not run the two parts on the same machine, if you have to do so, set `unicast=false`, like `multicast://224.5.6.7:1234?unicast=false`, or the unicast send to consumer will be taken by provider, and the same for consumers. Only multicast has this issue 4 | 5 | You can run multiple Demo Provider and Demo consumer to verify load balance. Demo Consumer can run multi instance directly. Because of port conflict, you can either run multi Demo Providers on different machines or modify the value of `dubbo.protocol.port` in `conf/dubbo.properties` under the install directory of `conf/dubbo.properties` 6 | 7 | You can add Simple Monitor as a monitor center, the default discovery strategy is Multicast by configuration center broadcast, display the dependency relationship, call times and cost 8 | 9 | You can use Zookeeper instead of Multicast as the configuration center, after Zookeeper Registry installation, modify `conf/dubbo.properties` under the installation directory of Demo Provider, Demo Consumer and Simple Monitor, change the value of `dubbo.registry.address` to `zookeeper://127.0.0.1:2181`(`redis://127.0.0.1:6379` for Redis Registry). the value for Simple Registry is `dubbo://127.0.0.1:9090` 10 | 11 | Zookeeper configuration address is recommended 12 | 13 | [^1]: NOTICE: multicast can be neither 127.0.0.1 nor the machine's IP address, it must be a type D broadcast address, from 224.0.0.0 to 239.255.255.255 14 | -------------------------------------------------------------------------------- /dubbo-user-book/references/api.md: -------------------------------------------------------------------------------- 1 | # API 参考手册 2 | 3 | Dubbo 的常规功能,都保持零侵入,但有些功能不得不用 API 侵入才能实现 [^1]。 4 | 5 | API 汇总如下: 6 | 7 | ## 配置 API 8 | 9 | ``` 10 | com.alibaba.dubbo.config.ServiceConfig 11 | com.alibaba.dubbo.config.ReferenceConfig 12 | com.alibaba.dubbo.config.ProtocolConfig 13 | com.alibaba.dubbo.config.RegistryConfig 14 | com.alibaba.dubbo.config.MonitorConfig 15 | com.alibaba.dubbo.config.ApplicationConfig 16 | com.alibaba.dubbo.config.ModuleConfig 17 | com.alibaba.dubbo.config.ProviderConfig 18 | com.alibaba.dubbo.config.ConsumerConfig 19 | com.alibaba.dubbo.config.MethodConfig 20 | com.alibaba.dubbo.config.ArgumentConfig 21 | ``` 22 | 详细参见:[API配置](../configuration/api.md) 23 | 24 | ## 注解 API 25 | 26 | ``` 27 | com.alibaba.dubbo.config.annotation.Service 28 | com.alibaba.dubbo.config.annotation.Reference 29 | ``` 30 | 31 | 详细参见:[注解配置](../configuration/annotation.md) 32 | 33 | ## 模型 API 34 | 35 | ``` 36 | com.alibaba.dubbo.common.URL 37 | com.alibaba.dubbo.rpc.RpcException 38 | ``` 39 | 40 | ## 上下文 API 41 | 42 | ``` 43 | com.alibaba.dubbo.rpc.RpcContext 44 | ``` 45 | 46 | 详细参见:[上下文信息](../demos/context.md) & [隐式传参](../demos/attachment.md) & [异步调用](../demos/async-call.md) 47 | 48 | ## 服务API 49 | 50 | ``` 51 | com.alibaba.dubbo.rpc.service.GenericService 52 | com.alibaba.dubbo.rpc.service.GenericException 53 | ``` 54 | 55 | 详细参见:[泛化引用](../demos/generic-reference.md) & [泛化实现](../demos/generic-service.md) 56 | 57 | ``` 58 | com.alibaba.dubbo.rpc.service.EchoService 59 | ``` 60 | 详细参见:[回声测试](../demos/echo-service.md) 61 | 62 | [^1]: 注意:Dubbo 中除这里声明以外的接口或类,都是内部接口或扩展接口,普通用户请不要直接依赖,否则升级版本可能出现不兼容。 -------------------------------------------------------------------------------- /dubbo-user-book/demos/async-call.md: -------------------------------------------------------------------------------- 1 | # 异步调用 2 | 3 | 基于 NIO 的非阻塞实现并行调用,客户端不需要启动多线程即可完成并行调用多个远程服务,相对多线程开销较小。 [^1] 4 | 5 | ![/user-guide/images/future.jpg](../sources/images/future.jpg) 6 | 7 | 在 consumer.xml 中配置: 8 | 9 | ```xml 10 | 11 | 12 | 13 | 14 | 15 | 16 | ``` 17 | 18 | 调用代码: 19 | 20 | ```java 21 | // 此调用会立即返回null 22 | fooService.findFoo(fooId); 23 | // 拿到调用的Future引用,当结果返回后,会被通知和设置到此Future 24 | Future fooFuture = RpcContext.getContext().getFuture(); 25 | 26 | // 此调用会立即返回null 27 | barService.findBar(barId); 28 | // 拿到调用的Future引用,当结果返回后,会被通知和设置到此Future 29 | Future barFuture = RpcContext.getContext().getFuture(); 30 | 31 | // 此时findFoo和findBar的请求同时在执行,客户端不需要启动多线程来支持并行,而是借助NIO的非阻塞完成 32 | 33 | // 如果foo已返回,直接拿到返回值,否则线程wait住,等待foo返回后,线程会被notify唤醒 34 | Foo foo = fooFuture.get(); 35 | // 同理等待bar返回 36 | Bar bar = barFuture.get(); 37 | 38 | // 如果foo需要5秒返回,bar需要6秒返回,实际只需等6秒,即可获取到foo和bar,进行接下来的处理。 39 | ``` 40 | 41 | 你也可以设置是否等待消息发出: [^2] 42 | 43 | * `sent="true"` 等待消息发出,消息发送失败将抛出异常。 44 | * `sent="false"` 不等待消息发出,将消息放入 IO 队列,即刻返回。 45 | 46 | ```xml 47 | 48 | ``` 49 | 50 | 如果你只是想异步,完全忽略返回值,可以配置 `return="false"`,以减少 Future 对象的创建和管理成本: 51 | 52 | ```xml 53 | 54 | ``` 55 | 56 | [^1]: `2.0.6` 及其以上版本支持 57 | [^2]: 异步总是不等待返回 -------------------------------------------------------------------------------- /dubbo-dev-book/impls/monitor.md: -------------------------------------------------------------------------------- 1 | # 监控中心扩展 2 | 3 | ## 扩展说明 4 | 5 | 负责服务调用次和调用时间的监控。 6 | 7 | ## 扩展接口 8 | 9 | * `com.alibaba.dubbo.monitor.MonitorFactory` 10 | * `com.alibaba.dubbo.monitor.Monitor` 11 | 12 | ## 扩展配置 13 | 14 | ```xml 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | com.alibaba.dubbo.monitor.support.dubbo.DubboMonitorFactory 22 | 23 | ## 扩展示例 24 | 25 | Maven 项目结构: 26 | 27 | ``` 28 | src 29 | |-main 30 | |-java 31 | |-com 32 | |-xxx 33 | |-XxxMonitorFactoryjava (实现MonitorFactory接口) 34 | |-XxxMonitor.java (实现Monitor接口) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.monitor.MonitorFactory (纯文本文件,内容为:xxx=com.xxx.XxxMonitorFactory) 39 | ``` 40 | 41 | XxxMonitorFactory.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.monitor.MonitorFactory; 47 | import com.alibaba.dubbo.monitor.Monitor; 48 | import com.alibaba.dubbo.common.URL; 49 | 50 | public class XxxMonitorFactory implements MonitorFactory { 51 | public Monitor getMonitor(URL url) { 52 | return new XxxMonitor(url); 53 | } 54 | } 55 | ``` 56 | 57 | XxxMonitor.java: 58 | 59 | ```java 60 | package com.xxx; 61 | 62 | import com.alibaba.dubbo.monitor.Monitor; 63 | 64 | public class XxxMonitor implements Monitor { 65 | public void count(URL statistics) { 66 | // ... 67 | } 68 | } 69 | ``` 70 | 71 | META-INF/dubbo/com.alibaba.dubbo.monitor.MonitorFactory: 72 | 73 | ```properties 74 | xxx=com.xxx.XxxMonitorFactory 75 | ``` -------------------------------------------------------------------------------- /dubbo-user-book/references/protocol/hessian.md: -------------------------------------------------------------------------------- 1 | # hessian:// 2 | 3 | Hessian [^1] 协议用于集成 Hessian 的服务,Hessian 底层采用 Http 通讯,采用 Servlet 暴露服务,Dubbo 缺省内嵌 Jetty 作为服务器实现。 4 | 5 | Dubbo 的 Hessian 协议可以和原生 Hessian 服务互操作,即: 6 | 7 | * 提供者用 Dubbo 的 Hessian 协议暴露服务,消费者直接用标准 Hessian 接口调用 8 | * 或者提供方用标准 Hessian 暴露服务,消费方用 Dubbo 的 Hessian 协议调用。 9 | 10 | ## 特性 11 | 12 | * 连接个数:多连接 13 | * 连接方式:短连接 14 | * 传输协议:HTTP 15 | * 传输方式:同步传输 16 | * 序列化:Hessian二进制序列化 17 | * 适用范围:传入传出参数数据包较大,提供者比消费者个数多,提供者压力较大,可传文件。 18 | * 适用场景:页面传输,文件传输,或与原生hessian服务互操作 19 | 20 | ## 依赖 21 | 22 | ```xml 23 | 24 | com.caucho 25 | hessian 26 | 4.0.7 27 | 28 | ``` 29 | 30 | ## 约束 31 | 32 | * 参数及返回值需实现 `Serializable` 接口 33 | * 参数及返回值不能自定义实现 `List`, `Map`, `Number`, `Date`, `Calendar` 等接口,只能用 JDK 自带的实现,因为 hessian 会做特殊处理,自定义实现类中的属性值都会丢失。 34 | 35 | ## 配置 36 | 37 | 定义 hessian 协议: 38 | 39 | ```xml 40 | 41 | ``` 42 | 43 | 设置默认协议: 44 | 45 | ```xml 46 | 47 | ``` 48 | 49 | 设置 service 协议: 50 | 51 | ```xml 52 | 53 | ``` 54 | 55 | 多端口: 56 | 57 | ```xml 58 | 59 | 60 | ``` 61 | 62 | 直连: 63 | 64 | ```xml 65 | 66 | ``` 67 | 68 | [^1]: [Hessian](http://hessian.caucho.com) 是 Caucho 开源的一个 RPC 框架,其通讯效率高于 WebService 和 Java 自带的序列化。 69 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/threadpool.md: -------------------------------------------------------------------------------- 1 | # ThreadPool Extension 2 | 3 | ## Summary 4 | 5 | Thread pool strategy extension for service provider. When server receives one request, it needs a thread from thread pool to execute business logic in service provider. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.common.threadpool.ThreadPool` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extension 20 | 21 | * `com.alibaba.dubbo.common.threadpool.FixedThreadPool` 22 | * `com.alibaba.dubbo.common.threadpool.CachedThreadPool` 23 | 24 | ## Extension Guide 25 | 26 | Directory layout: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxThreadPool.java (ThreadPool implementation) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.common.threadpool.ThreadPool (plain text file with the content: xxx=com.xxx.XxxThreadPool) 39 | ``` 40 | 41 | XxxThreadPool.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.common.threadpool.ThreadPool; 47 | import java.util.concurrent.Executor; 48 | 49 | public class XxxThreadPool implements ThreadPool { 50 | public Executor getExecutor() { 51 | // ... 52 | } 53 | } 54 | ``` 55 | 56 | META-INF/dubbo/com.alibaba.dubbo.common.threadpool.ThreadPool: 57 | 58 | ```properties 59 | xxx=com.xxx.XxxThreadPool 60 | ``` 61 | 62 | -------------------------------------------------------------------------------- /dubbo-dev-book/principals/expansibility.md: -------------------------------------------------------------------------------- 1 | # 谈谈扩充式扩展与增量式扩展 2 | 3 | > http://javatar.iteye.com/blog/690845 4 | 5 | 6 | 我们平台的产品越来越多,产品的功能也越来越多。平台的产品为了适应各 BU 和部门以及产品线的需求,势必会将很多不相干的功能凑在一起,客户可以选择性的使用。为了兼容更多的需求,每个产品,每个框架,都在不停的扩展,而我们经常会选择一些扩展的扩展方式,也就是将新旧功能扩展成一个通用实现。我想讨论是,有些情况下也可以考虑增量式的扩展方式,也就是保留原功能的简单性,新功能独立实现。我最近一直做分布式服务框架的开发,就拿我们项目中的问题开涮吧。 7 | 8 | 比如:远程调用框架,肯定少不了序列化功能,功能很简单,就是把流转成对象,对象转成流。但因有些地方可能会使用 osgi,这样序列化时,IO 所在的 ClassLoader 可能和业务方的 ClassLoader 是隔离的。需要将流转换成 byte[] 数组,然后传给业务方的 ClassLoader 进行序列化。为了适应 osgi 需求,把原来非 osgi 与 osgi 的场景扩展了一下,这样,不管是不是 osgi 环境,都先将流转成 byte[] 数组,拷贝一次。然而,大部分场景都用不上 osgi,却为 osgi 付出了代价。而如果采用增量式扩展方式,非 osgi 的代码原封不动,再加一个 osgi 的实现,要用 osgi 的时候,直接依赖 osgi 实现即可。 9 | 10 | 再比如:最开始,远程服务都是基于接口方法,进行透明化调用的。这样,扩展接口就是, invoke(Method method, Object[] args),后来,有了无接口调用的需求,就是没有接口方法也能调用,并将 POJO 对象都转换成 Map 表示。因为 Method 对象是不能直接 new 出来的,我们不自觉选了一个扩展式扩展,把扩展接口改成了 invoke(String methodName, String[] parameterTypes, String returnTypes, Object[] args),导致不管是不是无接口调用,都得把 parameterTypes 从 Class[] 转成 String[]。如果选用增量式扩展,应该是保持原有接口不变,增加一个 GeneralService 接口,里面有一个通用的 invoke() 方法,和其它正常业务上的接口一样的调用方式,扩展接口也不用变,只是 GeneralServiceImpl 的 invoke() 实现会将收到的调用转给目标接口,这样就能将新功能增量到旧功能上,并保持原来结构的简单性。 11 | 12 | 再再比如:无状态消息发送,很简单,序列化一个对象发过去就行。后来有了同步消息发送需求,需要一个 Request/Response 进行配对,采用扩展式扩展,自然想到,无状态消息其实是一个没有 Response 的 Request,所以在 Request 里加一个 boolean 状态,表示要不要返回 Response。如果再来一个会话消息发送需求,那就再加一个 Session 交互,然后发现,原来同步消息发送是会话消息的一种特殊情况,所有场景都传 Session,不需要 Session 的地方无视即可。 13 | 14 | ![open-expand](../sources/images/open-expand.jpg) 15 | 16 | 如果采用增量式扩展,无状态消息发送原封不动,同步消息发送,在无状态消息基础上加一个 Request/Response 处理,会话消息发送,再加一个 SessionRequest/SessionResponse 处理。 17 | 18 | ![close-expand](../sources/images/close-expand.jpg) -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/invoker-listener.md: -------------------------------------------------------------------------------- 1 | # InvokerListener Extension 2 | 3 | ## Summary 4 | 5 | Fire event when there's any service referenced. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.rpc.InvokerListener` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | 18 | 19 | ``` 20 | 21 | ## Existing Extension 22 | 23 | `com.alibaba.dubbo.rpc.listener.DeprecatedInvokerListener` 24 | 25 | ## Extension Guide 26 | 27 | Directory layout: 28 | 29 | ``` 30 | src 31 | |-main 32 | |-java 33 | |-com 34 | |-xxx 35 | |-XxxInvokerListener.java (InvokerListener implementation) 36 | |-resources 37 | |-META-INF 38 | |-dubbo 39 | |-com.alibaba.dubbo.rpc.InvokerListener (plain text file with the content: xxx=com.xxx.XxxInvokerListener) 40 | ``` 41 | 42 | XxxInvokerListener.java: 43 | 44 | ```java 45 | package com.xxx; 46 | 47 | import com.alibaba.dubbo.rpc.InvokerListener; 48 | import com.alibaba.dubbo.rpc.Invoker; 49 | import com.alibaba.dubbo.rpc.RpcException; 50 | 51 | public class XxxInvokerListener implements InvokerListener { 52 | public void referred(Invoker invoker) throws RpcException { 53 | // ... 54 | } 55 | public void destroyed(Invoker invoker) throws RpcException { 56 | // ... 57 | } 58 | } 59 | ``` 60 | 61 | META-INF/dubbo/com.alibaba.dubbo.rpc.InvokerListener: 62 | 63 | ```properties 64 | xxx=com.xxx.XxxInvokerListener 65 | ``` 66 | -------------------------------------------------------------------------------- /dubbo-admin-book/install/simple-monitor-center.md: -------------------------------------------------------------------------------- 1 | # Simple 监控中心安装 2 | 3 | ## 安装步骤 4 | 5 | 安装: 6 | 7 | ```sh 8 | git clone https://github.com/apache/incubator-dubbo-ops 9 | cd incubator-dubbo-ops && mvn package 10 | cd dubbo-monitor-simple/target && tar xvf dubbo-monitor-simple-2.0.0-assembly.tar.gz 11 | cd dubbo-monitor-simple-2.0.0 12 | ``` 13 | 14 | 配置: 15 | 16 | ```sh 17 | vi conf/dubbo.properties 18 | ``` 19 | 20 | 启动: 21 | 22 | ```sh 23 | ./assembly.bin/start.sh 24 | ``` 25 | 26 | 停止: 27 | 28 | ```sh 29 | ./assembly.bin/stop.sh 30 | ``` 31 | 32 | 重启: 33 | 34 | ```sh 35 | ./assembly.bin/restart.sh 36 | ``` 37 | 38 | 调试: 39 | 40 | ```sh 41 | ./assembly.bin/start.sh debug 42 | ``` 43 | 44 | 系统状态: 45 | 46 | ```sh 47 | ./assembly.bin/dump.sh 48 | ``` 49 | 50 | 总控入口: 51 | 52 | ```sh 53 | ./assembly.bin/server.sh start 54 | ./assembly.bin/server.sh stop 55 | ./assembly.bin/server.sh restart 56 | ./assembly.bin/server.sh debug 57 | ./assembly.bin/server.sh dump 58 | ``` 59 | 60 | 标准输出: 61 | 62 | ```sh 63 | tail -f logs/stdout.log 64 | ``` 65 | 66 | 命令行 [^1]: 67 | 68 | ```sh 69 | telnet 127.0.0.1 7070 70 | help 71 | ``` 72 | 73 | 或者: 74 | 75 | ```sh 76 | echo status | nc -i 1 127.0.0.1 7070 77 | ``` 78 | 79 | 访问: 80 | 81 | ``` 82 | http://127.0.0.1:8080 83 | ``` 84 | 85 | ![/admin-guide/images/dubbo-monitor-simple.jpg](../sources/images/dubbo-monitor-simple.jpg) 86 | 87 | ## 注意事项 88 | Simple Monitor 挂掉不会影响到 Consumer 和 Provider 之间的调用,所以用于生产环境不会有风险。 89 | 90 | Simple Monitor 采用磁盘存储统计信息,请注意安装机器的磁盘限制,如果要集群,建议用mount共享磁盘。 91 | 92 | charts 目录必须放在 `jetty.directory` 下,否则页面上访问不了。 93 | 94 | [^1]: 请参考 [Telnet 命令参考手册](../../dubbo-user-book/references/telnet.md) 95 | 96 | -------------------------------------------------------------------------------- /dubbo-user-book/demos/concurrency-control.md: -------------------------------------------------------------------------------- 1 | # 并发控制 2 | 3 | ## 配置样例 4 | 5 | ### 样例 1 6 | 7 | 限制 `com.foo.BarService` 的每个方法,服务器端并发执行(或占用线程池线程数)不能超过 10 个: 8 | 9 | ```xml 10 | 11 | ``` 12 | 13 | ### 样例 2 14 | 15 | 限制 `com.foo.BarService` 的 `sayHello` 方法,服务器端并发执行(或占用线程池线程数)不能超过 10 个: 16 | 17 | ```xml 18 | 19 | 20 | 21 | ``` 22 | ### 样例 3 23 | 24 | 限制 `com.foo.BarService` 的每个方法,每客户端并发执行(或占用连接的请求数)不能超过 10 个: 25 | 26 | ```xml 27 | 28 | ``` 29 | 30 | 或 31 | 32 | ```xml 33 | 34 | ``` 35 | 36 | ### 样例 4 37 | 38 | 限制 `com.foo.BarService` 的 `sayHello` 方法,每客户端并发执行(或占用连接的请求数)不能超过 10 个: 39 | 40 | ```xml 41 | 42 | 43 | 44 | ``` 45 | 46 | 或 47 | 48 | ```xml 49 | 50 | 51 | 52 | ``` 53 | 54 | 如果 `` 和 `` 都配了actives,`` 优先,参见:[配置的覆盖策略](../configuration/xml.md#配置覆盖关系)。 55 | 56 | ## Load Balance 均衡 57 | 58 | 配置服务的客户端的 `loadbalance` 属性为 `leastactive`,此 Loadbalance 会调用并发数最小的 Provider(Consumer端并发数)。 59 | 60 | ```xml 61 | 62 | ``` 63 | 64 | 或 65 | 66 | ```xml 67 | 68 | ``` -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/exporter-listener.md: -------------------------------------------------------------------------------- 1 | # ExporterListener Extension 2 | 3 | ## Summary 4 | 5 | Fire events when there's any service exported. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.rpc.ExporterListener` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | 18 | ``` 19 | 20 | ## Existing Extension 21 | 22 | `com.alibaba.dubbo.registry.directory.RegistryExporterListener` 23 | 24 | ## Extension Guide 25 | 26 | Directory layout: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxExporterListener.java (ExporterListener implementation) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.ExporterListener (plain text file with the content: xxx=com.xxx.XxxExporterListener) 39 | ``` 40 | 41 | XxxExporterListener.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.ExporterListener; 47 | import com.alibaba.dubbo.rpc.Exporter; 48 | import com.alibaba.dubbo.rpc.RpcException; 49 | 50 | 51 | public class XxxExporterListener implements ExporterListener { 52 | public void exported(Exporter exporter) throws RpcException { 53 | // ... 54 | } 55 | public void unexported(Exporter exporter) throws RpcException { 56 | // ... 57 | } 58 | } 59 | ``` 60 | 61 | META-INF/dubbo/com.alibaba.dubbo.rpc.ExporterListener: 62 | 63 | ```properties 64 | xxx=com.xxx.XxxExporterListener 65 | ``` 66 | 67 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/proxy-factory.md: -------------------------------------------------------------------------------- 1 | # ProxyFactory Extension 2 | 3 | ## Summary 4 | 5 | Convert `Invoker` into business interface. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.rpc.ProxyFactory` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extension 20 | 21 | * `com.alibaba.dubbo.rpc.proxy.JdkProxyFactory` 22 | * `com.alibaba.dubbo.rpc.proxy.JavassistProxyFactory` 23 | 24 | ## Extension Guide 25 | 26 | Directory layout: 27 | 28 | ``` 29 | src 30 | |-main 31 | |-java 32 | |-com 33 | |-xxx 34 | |-XxxProxyFactory.java (ProxyFactory implementation) 35 | |-resources 36 | |-META-INF 37 | |-dubbo 38 | |-com.alibaba.dubbo.rpc.ProxyFactory (plain text file with the content: xxx=com.xxx.XxxProxyFactory) 39 | ``` 40 | 41 | XxxProxyFactory.java: 42 | 43 | ```java 44 | package com.xxx; 45 | 46 | import com.alibaba.dubbo.rpc.ProxyFactory; 47 | import com.alibaba.dubbo.rpc.Invoker; 48 | import com.alibaba.dubbo.rpc.RpcException; 49 | 50 | 51 | public class XxxProxyFactory implements ProxyFactory { 52 | public T getProxy(Invoker invoker) throws RpcException { 53 | // ... 54 | } 55 | public Invoker getInvoker(T proxy, Class type, URL url) throws RpcException { 56 | // ... 57 | } 58 | } 59 | ``` 60 | 61 | META-INF/dubbo/com.alibaba.dubbo.rpc.ProxyFactory: 62 | 63 | ```properties 64 | xxx=com.xxx.XxxProxyFactory 65 | ``` 66 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/status-checker.md: -------------------------------------------------------------------------------- 1 | # 状态检查扩展 2 | 3 | ## 扩展说明 4 | 5 | 检查服务依赖各种资源的状态,此状态检查可同时用于 telnet 的 status 命令和 hosting 的 status 页面。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.common.status.StatusChecker` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## 已知扩展 20 | 21 | * `com.alibaba.dubbo.common.status.support.MemoryStatusChecker` 22 | * `com.alibaba.dubbo.common.status.support.LoadStatusChecker` 23 | * `com.alibaba.dubbo.rpc.dubbo.status.ServerStatusChecker` 24 | * `com.alibaba.dubbo.rpc.dubbo.status.ThreadPoolStatusChecker` 25 | * `com.alibaba.dubbo.registry.directory.RegistryStatusChecker` 26 | * `com.alibaba.dubbo.rpc.config.spring.status.SpringStatusChecker` 27 | * `com.alibaba.dubbo.rpc.config.spring.status.DataSourceStatusChecker` 28 | 29 | ## 扩展示例 30 | 31 | Maven 项目结构: 32 | 33 | ``` 34 | src 35 | |-main 36 | |-java 37 | |-com 38 | |-xxx 39 | |-XxxStatusChecker.java (实现StatusChecker接口) 40 | |-resources 41 | |-META-INF 42 | |-dubbo 43 | |-com.alibaba.dubbo.common.status.StatusChecker (纯文本文件,内容为:xxx=com.xxx.XxxStatusChecker) 44 | ``` 45 | 46 | XxxStatusChecker.java: 47 | 48 | ```java 49 | package com.xxx; 50 | 51 | import com.alibaba.dubbo.common.status.StatusChecker; 52 | 53 | public class XxxStatusChecker implements StatusChecker { 54 | public Status check() { 55 | // ... 56 | } 57 | } 58 | ``` 59 | 60 | META-INF/dubbo/com.alibaba.dubbo.common.status.StatusChecker: 61 | 62 | ```properties 63 | xxx=com.xxx.XxxStatusChecker 64 | ``` 65 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/dispatcher.md: -------------------------------------------------------------------------------- 1 | # Dispatcher Extension 2 | 3 | ## Summary 4 | 5 | Thread pool dispatch strategy. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.remoting.Dispatcher` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extensions 20 | 21 | * `com.alibaba.dubbo.remoting.transport.dispatcher.all.AllDispatcher` 22 | * `com.alibaba.dubbo.remoting.transport.dispatcher.direct.DirectDispatcher` 23 | * `com.alibaba.dubbo.remoting.transport.dispatcher.message.MessageOnlyDispatcher` 24 | * `com.alibaba.dubbo.remoting.transport.dispatcher.execution.ExecutionDispatcher` 25 | * `com.alibaba.dubbo.remoting.transport.dispatcher.connection.ConnectionOrderedDispatcher` 26 | 27 | ## Extension Guide 28 | 29 | Directory layout: 30 | 31 | ``` 32 | src 33 | |-main 34 | |-java 35 | |-com 36 | |-xxx 37 | |-XxxDispatcher.java (Dispatcher implementation) 38 | |-resources 39 | |-META-INF 40 | |-dubbo 41 | |-com.alibaba.dubbo.remoting.Dispatcher (plain text file with the content: xxx=com.xxx.XxxDispatcher) 42 | ``` 43 | 44 | XxxDispatcher.java: 45 | 46 | ```java 47 | package com.xxx; 48 | 49 | import com.alibaba.dubbo.remoting.Dispatcher; 50 | 51 | public class XxxDispatcher implements Dispatcher { 52 | public Group lookup(URL url) { 53 | // ... 54 | } 55 | } 56 | ``` 57 | 58 | META-INF/dubbo/com.alibaba.dubbo.remoting.Dispatcher: 59 | 60 | ```properties 61 | xxx=com.xxx.XxxDispatcher 62 | ``` 63 | -------------------------------------------------------------------------------- /dubbo-user-book/references/xml/dubbo-module.md: -------------------------------------------------------------------------------- 1 | 35 | 36 | 45 | # dubbo:module 46 | 47 | 模块信息配置。对应的配置类 `com.alibaba.dubbo.config.ModuleConfig` 48 | 49 | | 属性 | 对应URL参数 | 类型 | 是否必填 | 缺省值 | 作用 | 描述 | 兼容性 | 50 | | --- | --- | ---- | --- | --- | --- | --- | --- | 51 | | name | module | string | 必填 | | 服务治理 | 当前模块名称,用于注册中心计算模块间依赖关系 | 2.2.0以上版本 | 52 | | version | module.version | string | 可选 | | 服务治理 | 当前模块的版本 | 2.2.0以上版本 | 53 | | owner | owner | string | 可选 | | 服务治理 | 模块负责人,用于服务治理,请填写负责人公司邮箱前缀 | 2.2.0以上版本 | 54 | | organization | organization | string | 可选 | | 服务治理 | 组织名称(BU或部门),用于注册中心区分服务来源,此配置项建议不要使用autoconfig,直接写死在配置中,比如china,intl,itu,crm,asc,dw,aliexpress等 | 2.2.0以上版本 | 55 | -------------------------------------------------------------------------------- /dubbo-dev-book/impls/logger-adapter.md: -------------------------------------------------------------------------------- 1 | # 日志适配扩展 2 | 3 | ## 扩展说明 4 | 5 | 日志输出适配扩展点。 6 | 7 | ## 扩展接口 8 | 9 | `com.alibaba.dubbo.common.logger.LoggerAdapter` 10 | 11 | ## 扩展配置 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | 或者: 18 | 19 | ```sh 20 | -Ddubbo:application.logger=xxx 21 | ``` 22 | 23 | ## 已知扩展 24 | 25 | * `com.alibaba.dubbo.common.logger.slf4j.Slf4jLoggerAdapter` 26 | * `com.alibaba.dubbo.common.logger.jcl.JclLoggerAdapter` 27 | * `com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter` 28 | * `com.alibaba.dubbo.common.logger.jdk.JdkLoggerAdapter` 29 | 30 | ## 扩展示例 31 | 32 | Maven 项目结构: 33 | 34 | ``` 35 | src 36 | |-main 37 | |-java 38 | |-com 39 | |-xxx 40 | |-XxxLoggerAdapter.java (实现LoggerAdapter接口) 41 | |-resources 42 | |-META-INF 43 | |-dubbo 44 | |-com.alibaba.dubbo.common.logger.LoggerAdapter (纯文本文件,内容为:xxx=com.xxx.XxxLoggerAdapter) 45 | ``` 46 | 47 | XxxLoggerAdapter.java: 48 | 49 | ```java 50 | package com.xxx; 51 | 52 | import com.alibaba.dubbo.common.logger.LoggerAdapter; 53 | 54 | public class XxxLoggerAdapter implements LoggerAdapter { 55 | public Logger getLogger(URL url) { 56 | // ... 57 | } 58 | } 59 | ``` 60 | 61 | XxxLogger.java: 62 | 63 | ```java 64 | package com.xxx; 65 | 66 | import com.alibaba.dubbo.common.logger.Logger; 67 | 68 | public class XxxLogger implements Logger { 69 | public XxxLogger(URL url) { 70 | // ... 71 | } 72 | public void info(String msg) { 73 | // ... 74 | } 75 | // ... 76 | } 77 | ``` 78 | 79 | META-INF/dubbo/com.alibaba.dubbo.common.logger.LoggerAdapter: 80 | 81 | ```properties 82 | xxx=com.xxx.XxxLoggerAdapter 83 | ``` -------------------------------------------------------------------------------- /dubbo-user-book/demos/config-rule.md: -------------------------------------------------------------------------------- 1 | # 配置规则 2 | 3 | 向注册中心写入动态配置覆盖规则 [^1]。该功能通常由监控中心或治理中心的页面完成。 4 | 5 | ```java 6 | RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); 7 | Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181")); 8 | registry.register(URL.valueOf("override://0.0.0.0/com.foo.BarService?category=configurators&dynamic=false&application=foo&timeout=1000")); 9 | ``` 10 | 11 | 其中: 12 | 13 | * `override://` 表示数据采用覆盖方式,支持 `override` 和 `absent`,可扩展,**必填**。 14 | * `0.0.0.0` 表示对所有 IP 地址生效,如果只想覆盖某个 IP 的数据,请填入具体 IP,**必填**。 15 | * `com.foo.BarService` 表示只对指定服务生效,**必填**。 16 | * `category=configurators` 表示该数据为动态配置类型,**必填**。 17 | * `dynamic=false` 表示该数据为持久数据,当注册方退出时,数据依然保存在注册中心,**必填**。 18 | * `enabled=true` 覆盖规则是否生效,可不填,缺省生效。 19 | * `application=foo` 表示只对指定应用生效,可不填,表示对所有应用生效。 20 | * `timeout=1000` 表示将满足以上条件的 `timeout` 参数的值覆盖为 1000。如果想覆盖其它参数,直接加在 `override` 的 URL 参数上。 21 | 22 | 示例: 23 | 24 | 1. 禁用提供者:(通常用于临时踢除某台提供者机器,相似的,禁止消费者访问请使用路由规则) 25 | 26 | ``` 27 | override://10.20.153.10/com.foo.BarService?category=configurators&dynamic=false&disbaled=true 28 | ``` 29 | 30 | 2. 调整权重:(通常用于容量评估,缺省权重为 100) 31 | 32 | ``` 33 | override://10.20.153.10/com.foo.BarService?category=configurators&dynamic=false&weight=200 34 | ``` 35 | 36 | 3. 调整负载均衡策略:(缺省负载均衡策略为 random) 37 | 38 | ``` 39 | override://10.20.153.10/com.foo.BarService?category=configurators&dynamic=false&loadbalance=leastactive 40 | ``` 41 | 42 | 4. 服务降级:(通常用于临时屏蔽某个出错的非关键服务) 43 | 44 | ``` 45 | override://0.0.0.0/com.foo.BarService?category=configurators&dynamic=false&application=foo&mock=force:return+null 46 | ``` 47 | 48 | [^1]: `2.2.0` 以上版本支持 -------------------------------------------------------------------------------- /dubbo-user-book-en/references/registry/multicast.md: -------------------------------------------------------------------------------- 1 | # Multicast Registry 2 | 3 | Multicast registry doesn't require to setup any central node. Just like IP address broadcast, dubbo service providers and consumers can discover each other through this mechanism. 4 | 5 | ![/user-guide/images/multicast.jpg](../../sources/images/multicast.jpg) 6 | 7 | 0. Service provider broadcasts its address when it boots up. 8 | 1. Service consumer broadcasts its subscription request when it boots up. 9 | 2. Once service provider receives subscription request, it unicasts its own address to the corresponding consumer, if `unicast=false` is set, then broadcast will be used instead. 10 | 3. When service consumer receives provider's address, it can start RPC invocation on the received address. 11 | 12 | Multicast is limited to network topology, and is only suitable for development purpose or small deployment. The valid multcast addresses scope is: 224.0.0.0 - 239.255.255.255. 13 | 14 | ## Configuration 15 | 16 | ```xml 17 | 18 | ``` 19 | 20 | Or 21 | 22 | ```xml 23 | 24 | ``` 25 | 26 | In order to avoid multicast as much as possible, dubbo uses unicast for address information from service provider to service consumer, if there are multiple consumer processes on one single machine, consumers need to set `unicast=false`, otherwise only one consumer can be able to receive the address info: 27 | 28 | ```xml 29 | 30 | ``` 31 | 32 | Or 33 | 34 | ```xml 35 | 36 | 37 | 38 | ``` -------------------------------------------------------------------------------- /dubbo-user-book/dependencies.md: -------------------------------------------------------------------------------- 1 | # 依赖 2 | 3 | ## 必须依赖 4 | JDK 1.6+ [^1] 5 | 6 | ## 缺省依赖 7 | 通过 `mvn dependency:tree > dep.log` 命令分析,Dubbo 缺省依赖以下三方库: 8 | 9 | ``` 10 | [INFO] +- com.alibaba:dubbo:jar:2.5.9-SNAPSHOT:compile 11 | [INFO] | +- org.springframework:spring-context:jar:4.3.10.RELEASE:compile 12 | [INFO] | +- org.javassist:javassist:jar:3.21.0-GA:compile 13 | [INFO] | \- org.jboss.netty:netty:jar:3.2.5.Final:compile 14 | ``` 15 | 16 | 这里所有依赖都是按照 Dubbo 缺省配置选的,这些缺省值是基于稳定性和性能考虑的。 17 | 18 | * javassist.jar [^3]: 如果 `` 或 ``,以及 ``,则不需要。 19 | * spring-context.jar [^4]: 如果用 `ServiceConfig` 和 `ReferenceConfig` 的 API 调用,则不需要。 20 | * netty.jar [^5]: 如果 `` 或 ``,则换成 mina.jar 或 grizzly.jar。如果 ``,则不需要。 21 | 22 | ## 可选依赖 23 | 以下依赖,在主动配置使用相应实现策略时用到,需自行加入依赖。 24 | 25 | * netty-all 4.0.35.Final 26 | * mina: 1.1.7 27 | * grizzly: 2.1.4 28 | * httpclient: 4.5.3 29 | * hessian_lite: 3.2.1-fixed 30 | * fastjson: 1.2.31 31 | * zookeeper: 3.4.9 32 | * jedis: 2.9.0 33 | * xmemcached: 1.3.6 34 | * hessian: 4.0.38 35 | * jetty: 6.1.26 36 | * hibernate-validator: 5.4.1.Final 37 | * zkclient: 0.2 38 | * curator: 2.12.0 39 | * cxf: 3.0.14 40 | * thrift: 0.8.0 41 | * servlet: 3.0 [^6] 42 | * validation-api: 1.1.0.GA [^6] 43 | * jcache: 1.0.0 [^6] 44 | * javax.el: 3.0.1-b08 [^6] 45 | * kryo: 4.0.1 46 | * kryo-serializers: 0.42 47 | * fst: 2.48-jdk-6 48 | * resteasy: 3.0.19.Final 49 | * tomcat-embed-core: 8.0.11 50 | * slf4j: 1.7.25 51 | * log4j: 1.2.16 52 | 53 | [^1]: 理论上 Dubbo 可以只依赖 JDK,不依赖于任何三方库运行,只需配置使用 JDK 相关实现策略 54 | [^2]: 日志输出包 55 | [^3]: 字节码生成 56 | [^4]: 配置解析 57 | [^5]: 网络传输 58 | [^6]: JEE 59 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/load-balance.md: -------------------------------------------------------------------------------- 1 | # LoadBalance Extension 2 | 3 | ## Summary 4 | 5 | Pick one from service providers and fire the invocation. 6 | 7 | ## Extension Interface 8 | 9 | `com.alibaba.dubbo.rpc.cluster.LoadBalance` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extension 20 | 21 | * `com.alibaba.dubbo.rpc.cluster.loadbalance.RandomLoadBalance` 22 | * `com.alibaba.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalance` 23 | * `com.alibaba.dubbo.rpc.cluster.loadbalance.LeastActiveLoadBalance` 24 | 25 | ## Extension Guide 26 | 27 | Directory layout: 28 | 29 | ``` 30 | src 31 | |-main 32 | |-java 33 | |-com 34 | |-xxx 35 | |-XxxLoadBalance.java (LoadBalance implementation) 36 | |-resources 37 | |-META-INF 38 | |-dubbo 39 | |-com.alibaba.dubbo.rpc.cluster.LoadBalance (plain text file with the content: xxx=com.xxx.XxxLoadBalance) 40 | ``` 41 | 42 | XxxLoadBalance.java: 43 | 44 | ```java 45 | package com.xxx; 46 | 47 | import com.alibaba.dubbo.rpc.cluster.LoadBalance; 48 | import com.alibaba.dubbo.rpc.Invoker; 49 | import com.alibaba.dubbo.rpc.Invocation; 50 | import com.alibaba.dubbo.rpc.RpcException; 51 | 52 | public class XxxLoadBalance implements LoadBalance { 53 | public Invoker select(List> invokers, Invocation invocation) throws RpcException { 54 | // ... 55 | } 56 | } 57 | ``` 58 | 59 | META-INF/dubbo/com.alibaba.dubbo.rpc.cluster.LoadBalance: 60 | 61 | ```properties 62 | xxx=com.xxx.XxxLoadBalance 63 | ``` 64 | -------------------------------------------------------------------------------- /dubbo-user-book-en/references/protocol/http.md: -------------------------------------------------------------------------------- 1 | # http:// 2 | 3 | Dubbo http protocol is base on HTTP form and Spring's HttpInvoker 4 | 5 | 6 | ## Features 7 | 8 | * Number of connections: multiple connections 9 | * Connection: short connection 10 | * Transmission protocol: HTTP 11 | * Transmission: synchronous transmission 12 | * Serialization: form serialization 13 | * Scope of application: Available browser view, the form or URL can be passed parameters, Temporary files are not supported. 14 | * Applicable scenarios: Services that need to be available to both application and browser 15 | 16 | ## Constraint 17 | * Parameters and return values must be consistent with Bean specifications 18 | 19 | ## Configuration 20 | 21 | configure http protocol: 22 | 23 | ```xml 24 | 25 | ``` 26 | 27 | configure Jetty Server (default): 28 | 29 | ```xml 30 | 31 | ``` 32 | 33 | configure Servlet Bridge Server (recommend): 34 | 35 | ```xml 36 | 37 | ``` 38 | 39 | configure DispatcherServlet: 40 | 41 | ```xml 42 | 43 | dubbo 44 | com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet 45 | 1 46 | 47 | 48 | dubbo 49 | /* 50 | 51 | ``` 52 | 53 | Note that if you use servlets to dispatch requests: 54 | 55 | * the port of protocol `` must same as servlet container's. 56 | * the context path of protocol `` must same as servlet application's. 57 | 58 | 59 | -------------------------------------------------------------------------------- /dubbo-dev-book-en/impls/validation.md: -------------------------------------------------------------------------------- 1 | # Validation Extension 2 | 3 | ## Summary 4 | 5 | Extension for parameter validation. 6 | 7 | ## Extension Inteface 8 | 9 | `com.alibaba.dubbo.validation.Validation` 10 | 11 | ## Extension Configuration 12 | 13 | ```xml 14 | 15 | 16 | 17 | ``` 18 | 19 | ## Existing Extension 20 | 21 | `com.alibaba.dubbo.validation.support.jvalidation.JValidation` 22 | 23 | ## Extension Guide 24 | 25 | Directory layout: 26 | 27 | ``` 28 | src 29 | |-main 30 | |-java 31 | |-com 32 | |-xxx 33 | |-XxxValidation.java (Validation implementation) 34 | |-resources 35 | |-META-INF 36 | |-dubbo 37 | |-com.alibaba.dubbo.validation.Validation (plain text file with the content: xxx=com.xxx.XxxValidation) 38 | ``` 39 | 40 | XxxValidation.java: 41 | 42 | ```java 43 | package com.xxx; 44 | 45 | import com.alibaba.dubbo.validation.Validation; 46 | 47 | public class XxxValidation implements Validation { 48 | public Object getValidator(URL url) { 49 | // ... 50 | } 51 | } 52 | ``` 53 | 54 | XxxValidator.java: 55 | 56 | ```java 57 | package com.xxx; 58 | 59 | import com.alibaba.dubbo.validation.Validator; 60 | 61 | public class XxxValidator implements Validator { 62 | public XxxValidator(URL url) { 63 | // ... 64 | } 65 | public void validate(Invocation invocation) throws Exception { 66 | // ... 67 | } 68 | } 69 | ``` 70 | 71 | META-INF/dubbo/com.alibaba.dubbo.validation.Validation: 72 | 73 | ```properties 74 | xxx=com.xxx.XxxValidation 75 | ``` -------------------------------------------------------------------------------- /dubbo-user-book-en/demos/local-mock.md: -------------------------------------------------------------------------------- 1 | # Local mock 2 | 3 | Local mock [^1] is usually used for service downgrade, such as a verification service, the client does not throw an exception when the service provider hangs up all the time, but returns the authorization failed through the Mock data. 4 | 5 | Configured in the spring configuration file as follows: 6 | 7 | ```xml 8 | 9 | ``` 10 | 11 | or 12 | 13 | ```xml 14 | 15 | ``` 16 | 17 | Mock implementation in the project [^2]: 18 | 19 | ```java 20 | package com.foo; 21 | public class BarServiceMock implements BarService { 22 | public String sayHello(String name) { 23 | // You can return mock data, this method is only executed when an RpcException is thrown. 24 | return "mock data"; 25 | } 26 | } 27 | ``` 28 | 29 | If the service consumer often needs `try-catch` to catch exceptions, such as: 30 | 31 | ```java 32 | Offer offer = null; 33 | try { 34 | offer = offerService.findOffer(offerId); 35 | } catch (RpcException e) { 36 | logger.error(e); 37 | } 38 | ``` 39 | 40 | Consider changing to Mock implementation and return null in Mock implementation. If you just want to simply ignore the exception, `2.0.11` version or later version is available: 41 | 42 | ```xml 43 | 44 | ``` 45 | 46 | [^1]: Mock is a subset of the Stub. If you use Stub, you may need to rely on the RpcException class. If you use Mock, you do not need to rely on RpcException, when throwing RpcException, it will callback Mock implementation class. 47 | [^2]: BarServiceMock implements BarService and has a no-argument constructor. 48 | --------------------------------------------------------------------------------