<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Source Code Architecture on Apache Dubbo</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/</link><description>Recent content in Source Code Architecture on Apache Dubbo</description><generator>Hugo</generator><language>en</language><atom:link href="https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/index.xml" rel="self" type="application/rss+xml"/><item><title>Analysis of Single-Port Multi-Protocol Implementation Principles</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/multi-protocol/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/multi-protocol/</guid><description>&lt;p>By configuring protocols, Dubbo 3 can support port protocol multiplexing. For instance, after enabling port reuse with the Triple protocol, you can add support for the Dubbo protocol and the Qos protocol on the same port. These protocols are identified by a unified port reuse server, which can facilitate service protocol migration, save ports and related resources, and reduce operational complexity.&lt;/p>
&lt;p>&lt;img alt="pu-server-image1" src="https://deploy-preview-3202--dubbo.netlify.app/imgs/blog/pu-server/pu-server-flow.png">&lt;/p>
&lt;ul>
&lt;li>
&lt;p>During the service creation phase, different Protocol objects are created for export by retrieving service export protocol configurations from the Config layer. If it&amp;rsquo;s not the first time creating a port-reusing Server, the Exchanger saves data passed from the Protocol layer to the Server for subsequent processing of that protocol type&amp;rsquo;s messages.&lt;/p></description></item><item><title>Code Architecture</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/code-architecture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/code-architecture/</guid><description>&lt;h2 id="overall-design">Overall Design&lt;/h2>
&lt;p>&lt;img alt="/dev-guide/images/dubbo-framework.jpg" src="https://deploy-preview-3202--dubbo.netlify.app/imgs/dev/dubbo-framework.jpg">&lt;/p>
&lt;p>Legend explanation:&lt;/p>
&lt;ul>
&lt;li>The light blue background on the left side of the diagram represents the interfaces used by service consumers, the light green background on the right side represents the interfaces used by service providers, and the interfaces on the central axis are used by both parties.&lt;/li>
&lt;li>The diagram is divided into ten layers from bottom to top, with each layer being a one-way dependency. The black arrows on the right represent the dependency relationships between layers. Each layer can detach from the upper layer for reuse, where the Service and Config layers are APIs and the others are SPIs.&lt;/li>
&lt;li>The green small blocks represent extension interfaces, and the blue small blocks represent implementation classes. Only the implementation classes related to the inter-layer connections are shown in the diagram.&lt;/li>
&lt;li>The blue dashed lines represent the initialization process, i.e., the assembly chain during startup, the red solid lines represent the method invocation process, i.e., the runtime invocation chain, and the purple triangular arrows represent inheritance, where subclasses can be seen as the same node as their parent class. The text on the lines indicates the invoked methods.&lt;/li>
&lt;/ul>
&lt;h2 id="layer-descriptions">Layer Descriptions&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Config Layer&lt;/strong>: External configuration interface centered around &lt;code>ServiceConfig&lt;/code> and &lt;code>ReferenceConfig&lt;/code>, allowing direct initialization of configuration classes or generating configuration classes through Spring.&lt;/li>
&lt;li>&lt;strong>Proxy Layer&lt;/strong>: Transparent proxy for service interfaces, generating client Stubs and server Skeletons centered around &lt;code>ServiceProxy&lt;/code>, with the extension interface being &lt;code>ProxyFactory&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Registry Layer&lt;/strong>: Encapsulates the registration and discovery of service addresses, centered around service URLs, with extension interfaces &lt;code>RegistryFactory&lt;/code>, &lt;code>Registry&lt;/code>, &lt;code>RegistryService&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Cluster Layer&lt;/strong>: Encapsulates routing and load balancing for multiple providers and bridges to the registry, centered around &lt;code>Invoker&lt;/code>, with extension interfaces &lt;code>Cluster&lt;/code>, &lt;code>Directory&lt;/code>, &lt;code>Router&lt;/code>, &lt;code>LoadBalance&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Monitor Layer&lt;/strong>: Monitors RPC call counts and call durations, centered around &lt;code>Statistics&lt;/code>, with extension interfaces &lt;code>MonitorFactory&lt;/code>, &lt;code>Monitor&lt;/code>, &lt;code>MonitorService&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Protocol Layer&lt;/strong>: Encapsulates RPC calls, centered around &lt;code>Invocation&lt;/code> and &lt;code>Result&lt;/code>, with extension interfaces &lt;code>Protocol&lt;/code>, &lt;code>Invoker&lt;/code>, &lt;code>Exporter&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Exchange Layer&lt;/strong>: Encapsulates request-response patterns, synchronizing to asynchronous, centered around &lt;code>Request&lt;/code> and &lt;code>Response&lt;/code>, with extension interfaces &lt;code>Exchanger&lt;/code>, &lt;code>ExchangeChannel&lt;/code>, &lt;code>ExchangeClient&lt;/code>, &lt;code>ExchangeServer&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Transport Layer&lt;/strong>: Abstracts Mina and Netty into a unified interface, centered around &lt;code>Message&lt;/code>, with extension interfaces &lt;code>Channel&lt;/code>, &lt;code>Transporter&lt;/code>, &lt;code>Client&lt;/code>, &lt;code>Server&lt;/code>, &lt;code>Codec&lt;/code>.&lt;/li>
&lt;li>&lt;strong>Serialize Layer&lt;/strong>: Reusable tools, with extension interfaces &lt;code>Serialization&lt;/code>, &lt;code>ObjectInput&lt;/code>, &lt;code>ObjectOutput&lt;/code>, &lt;code>ThreadPool&lt;/code>.&lt;/li>
&lt;/ul>
&lt;h2 id="relationship-explanation">Relationship Explanation&lt;/h2>
&lt;ul>
&lt;li>In RPC, the Protocol is the core layer, meaning that as long as there is Protocol + Invoker + Exporter, non-transparent RPC calls can be completed, then applying Filters on the Invoker&amp;rsquo;s main process.&lt;/li>
&lt;li>The Consumer and Provider in the diagram are abstract concepts meant to help viewers understand which classes belong to the client and server side. The reason for not using Client and Server is that Dubbo employs Provider, Consumer, Registry, and Monitor to define logical topological nodes in many scenarios, maintaining a unified concept.&lt;/li>
&lt;li>Cluster is an external concept, meaning its purpose is to disguise multiple Invokers as a single Invoker, allowing others to focus only on the Protocol layer Invoker. Adding or removing Cluster will not affect other layers, as there is no need for Cluster with only one provider.&lt;/li>
&lt;li>The Proxy Layer encapsulates transparent proxying for all interfaces, and in other layers, it revolves around the Invoker. Only at the point of exposing for user use is Proxy used to convert Invoker into an interface or convert interface implementations into Invoker. This means removing the Proxy layer allows RPC to run, though it won&amp;rsquo;t be as transparent or seem as local as remote service calls.&lt;/li>
&lt;li>The Remoting implementation is the Dubbo protocol implementation. If you choose the RMI protocol, the entire Remoting will not be used. Remoting is internally divided into the Transport layer and the Exchange layer, where the Transport layer is responsible for one-way message transmission, abstracting Mina, Netty, and Grizzly, and it can also extend UDP transmission. The Exchange layer encapsulates Request-Response semantics on top of the Transport layer.&lt;/li>
&lt;li>The Registry and Monitor should not be counted as a layer but rather as independent nodes, drawn together for a global view in a layered manner.&lt;/li>
&lt;/ul>
&lt;h2 id="module-packaging">Module Packaging&lt;/h2>
&lt;p>&lt;img alt="/dev-guide/images/dubbo-modules.jpg" src="https://deploy-preview-3202--dubbo.netlify.app/imgs/dev/dubbo-modules.jpg">&lt;/p></description></item><item><title>Service Invocation Extension Points</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/service-invocation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/service-invocation/</guid><description>&lt;p>&lt;img alt="dubbo-architecture" src="https://deploy-preview-3202--dubbo.netlify.app/imgs/v3/concepts/invoke-arch.jpg">&lt;/p>
&lt;p>As shown in the figure above, from the perspective of service invocation, Dubbo provides a wealth of extension points in the call chain, covering load balancing methods, interceptors before and after service location, server processing interceptors, and more.
In simple terms, when Dubbo initiates a remote call, the main workflow can be divided into two parts: the consumer side and the server side.&lt;/p>
&lt;p>The workflow of the consumer side is as follows:&lt;/p></description></item><item><title>Extension Point Development Guide</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/dubbo-spi/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/dubbo-spi/</guid><description>&lt;h2 id="1-introduction-to-dubbo-spi-extensions">1. Introduction to Dubbo SPI Extensions&lt;/h2>
&lt;p>The extension mechanism in Dubbo is similar to the &lt;a href="https://www.baeldung.com/java-spi" target="_blank">JDK standard SPI extension points&lt;/a> principle. Dubbo has made certain modifications and enhancements:&lt;/p>
&lt;ul>
&lt;li>The JDK standard SPI instantiates all extension point implementations at once, which can waste resources if the extension implementations are resource-intensive but not used.&lt;/li>
&lt;li>If an extension point fails to load, JDK SPI does not provide detailed information to locate the problem, while Dubbo SPI logs the actual failure reason on failure and prints it out.&lt;/li>
&lt;li>Adds &lt;a href="https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/dubbo-spi/#23-ioc-mechanism">IOC&lt;/a>, &lt;a href="https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/reference-manual/architecture/dubbo-spi/#24-aop-mechanism">AOP&lt;/a> capabilities.&lt;/li>
&lt;li>Adds sorting capabilities.&lt;/li>
&lt;li>Adds conditional activation capabilities.&lt;/li>
&lt;li>Provides a series of more flexible APIs, such as &lt;code>getting all SPI extension implementations&lt;/code>, &lt;code>querying a specific extension implementation by name&lt;/code>, querying extensions by type, and querying extension implementations that match conditions.&lt;/li>
&lt;/ul>
&lt;h3 id="11-definition-of-spi">1.1 Definition of SPI&lt;/h3>
&lt;p>The SPI plugin in Dubbo is standard Java Interface definition and must contain the &lt;code>@org.apache.dubbo.common.extension.SPI&lt;/code> annotation:&lt;/p></description></item></channel></rss>