<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>RPC Framework on Apache Dubbo</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/</link><description>Recent content in RPC Framework on Apache Dubbo</description><generator>Hugo</generator><language>en</language><atom:link href="https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/index.xml" rel="self" type="application/rss+xml"/><item><title>Streaming Communication</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/streaming/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/streaming/</guid><description>&lt;p>Streaming communication is a new RPC data transfer mode offered by Dubbo3, suitable for the following scenarios:&lt;/p>
&lt;ul>
&lt;li>Interfaces that need to send large amounts of data that cannot be placed in a single RPC request or response, requiring batch sending. However, traditional multiple RPC calls cannot resolve issues of order and performance, and if order is to be guaranteed, they must be sent serially.&lt;/li>
&lt;li>Streaming scenarios where data needs to be processed in the order sent, and the data itself has no definite boundaries.&lt;/li>
&lt;li>Push scenarios where multiple messages are sent and processed within the same call context.&lt;/li>
&lt;/ul>
&lt;p>There are three types of Streaming communication:&lt;/p></description></item><item><title>Timeout Duration</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/timeout/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/timeout/</guid><description>&lt;h2 id="1-introduction">1. Introduction&lt;/h2>
&lt;p>This example demonstrates how to set the request timeout duration when initiating a call from the Dubbo-go client. You can view the &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/timeout" target="_blank">complete example source code&lt;/a> here.&lt;/p>
&lt;h2 id="2-how-to-set-the-request-timeout-duration">2. How to Set the Request Timeout Duration&lt;/h2>
&lt;p>When creating a client, you can set a global timeout using the &lt;code>client.WithRequestTimeout()&lt;/code> method (shared by all service proxies using this client).&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span> cli, err &lt;span style="color:#719e07">:=&lt;/span> client.&lt;span style="color:#268bd2">NewClient&lt;/span>(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> client.&lt;span style="color:#268bd2">WithClientURL&lt;/span>(&lt;span style="color:#2aa198">&amp;#34;tri://127.0.0.1:20000&amp;#34;&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> client.&lt;span style="color:#268bd2">WithClientRequestTimeout&lt;/span>(&lt;span style="color:#2aa198">3&lt;/span> &lt;span style="color:#719e07">*&lt;/span> time.Second),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> )
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can also create service-level timeout using &lt;code>client.WithRequestTimeout()&lt;/code> (all method calls initiated from the following service proxy &lt;code>svc&lt;/code> will use this timeout).&lt;/p></description></item><item><title>Communication Protocol</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/protocol/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/protocol/</guid><description>&lt;p>The Dubbo-go framework provides two built-in protocols: triple and dubbo. In addition, the framework offers various ways to extend protocol access.&lt;/p>
&lt;ul>
&lt;li>triple, a high-performance communication protocol based on HTTP/1 and HTTP/2, 100% compatible with gRPC, supports Unary, Streaming, and other communication modes; supports publishing REST-style HTTP services.&lt;/li>
&lt;li>dubbo, a high-performance private communication protocol based on TCP, with the disadvantage of poor universality, more suitable for use between Dubbo SDKs;&lt;/li>
&lt;li>Any protocol extension, by extending the protocol, it can support any RPC protocol. The official ecosystem provides support for JsonRPC, thrift, etc.&lt;/li>
&lt;/ul>
&lt;p>In this document, we will introduce the usage of the triple protocol, how to achieve mutual calls with existing dubbo2 systems, and extend support for more protocols. For more principled introductions, please refer to &lt;a href="https://deploy-preview-3202--dubbo.netlify.app/en/overview/reference/protocols/triple-spec/">Protocol Specification&lt;/a> or &lt;a href="https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/java-sdk/tasks/protocols/protocol/">related documents in dubbo java&lt;/a> .&lt;/p></description></item><item><title>Exception Type Return Values</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/error/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/error/</guid><description>&lt;h2 id="1-introduction">1. Introduction&lt;/h2>
&lt;p>This document demonstrates how to handle error type responses during RPC calls. You can view the &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/error" target="_blank">complete example source code here&lt;/a>.&lt;/p>
&lt;h2 id="2-example-details">2. Example Details&lt;/h2>
&lt;h3 id="21-server">2.1 Server&lt;/h3>
&lt;h4 id="server-proto-file">Server proto file&lt;/h4>
&lt;p>Source file path: dubbo-go-sample/error/proto/greet.proto&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-protobuf" data-lang="protobuf">&lt;span style="display:flex;">&lt;span>syntax &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">&amp;#34;proto3&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#719e07">package&lt;/span> greet;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#719e07">option&lt;/span> go_package &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">&amp;#34;github.com/apache/dubbo-go-samples/error/proto;greet&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">message&lt;/span> &lt;span style="color:#268bd2">GreetRequest&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#dc322f">string&lt;/span> name &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">1&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">message&lt;/span> &lt;span style="color:#268bd2">GreetResponse&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#dc322f">string&lt;/span> greeting &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#2aa198">1&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">service&lt;/span> GreetService {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#719e07">rpc&lt;/span> Greet(GreetRequest) &lt;span style="color:#719e07">returns&lt;/span> (GreetResponse) {}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="server-handler-file">Server handler file&lt;/h4>
&lt;p>Note that in this program design, the Greet method will only consider the request valid if it receives &lt;code>name=&amp;quot;right name&amp;quot;&lt;/code>; otherwise, it will return an error.&lt;/p></description></item><item><title>Health Check</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/healthcheck/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/healthcheck/</guid><description>&lt;h2 id="background">Background&lt;/h2>
&lt;p>Dubbo-go has a built-in health check service based on the triple protocol to help users manage and monitor the health status of services. You can view the &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/healthcheck" target="_blank">complete example source code&lt;/a> here.&lt;/p>
&lt;h2 id="usage">Usage&lt;/h2>
&lt;ul>
&lt;li>The framework automatically registers the health check service &lt;code>grpc.health.v1.Health&lt;/code> into the framework after starting via &lt;code>instance&lt;/code>, which records and exposes the health status of each triple service.&lt;/li>
&lt;li>The health check service can check the status of services in the framework by making an HTTP request or through client calls to the health check service. The interface called is &lt;code>grpc.health.v1.Health&lt;/code>, and the method is &lt;code>check&lt;/code>.&lt;/li>
&lt;/ul>
&lt;h2 id="1-call-the-health-check-service-through-the-client">1. Call the health check service through the client&lt;/h2>
&lt;p>Start the service in dubbo-go-samples/healthcheck/go-server, and the status of &lt;code>greet.GreetService&lt;/code> can be viewed through the client below.&lt;/p></description></item><item><title>Request Retry</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/retry/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/retry/</guid><description>&lt;p>When a service call fails, we can allow the framework to automatically retry a few times, which can improve the success rate of requests seen by users. In failover cluster mode, dubbo-go supports automatic retries.&lt;/p>
&lt;h2 id="1-introduction">1. Introduction&lt;/h2>
&lt;p>This example demonstrates how to configure the retry function when a client-side call fails. &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/retry" target="_blank">Full example source code&lt;/a>&lt;/p>
&lt;h2 id="2-how-to-use-the-retry-feature">2. How to Use the Retry Feature&lt;/h2>
&lt;p>When creating a client using &lt;code>client.NewClient()&lt;/code>, you can set the retry count using &lt;code>client.WithClientRetries()&lt;/code> method.&lt;/p></description></item><item><title>Passing Additional Parameters</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/attachments/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/attachments/</guid><description>&lt;p>&lt;strong>The most straightforward way to understand implicit parameter passing is through the HTTP header, which works exactly like an HTTP header, allowing any number of header parameters to be passed outside of the GET or POST request body.&lt;/strong> For RPC calls, the context provides the ability to pass additional parameters outside of the method signature&amp;rsquo;s parameters. The implementation varies slightly between different protocols:&lt;/p>
&lt;ul>
&lt;li>For the triple protocol, the attachment is converted into standard HTTP headers for transmission.&lt;/li>
&lt;li>For the Dubbo protocol, the attachment is encoded in a fixed location within the protocol body; please refer to the Dubbo protocol specification.&lt;/li>
&lt;/ul>
&lt;p>&lt;img alt="/user-guide/images/context.png" src="https://deploy-preview-3202--dubbo.netlify.app/imgs/user/context.png">&lt;/p></description></item><item><title>Startup check</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/start-check/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/start-check/</guid><description>&lt;p>The Dubbo framework, by default, checks the availability of dependent services at startup (whether the registry has available addresses). If not available, it throws an exception to prevent the application from completing initialization, allowing early detection of problems during deployment. The default is check=&amp;ldquo;true&amp;rdquo; and waits for 3 seconds.&lt;/p>
&lt;p>You can disable the check with check=&amp;ldquo;false&amp;rdquo;. For example, during testing, some services may not be of concern, or there may be circular dependencies, requiring one party to start first.&lt;/p></description></item><item><title>Filter Interceptor</title><link>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/filter/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3202--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/filter/</guid><description>&lt;p>Filters dynamically intercept requests or responses to transform or utilize the information contained in the requests or responses. Filters do not typically create responses themselves but provide generic functions that can be &amp;ldquo;attached&amp;rdquo; to any RPC request. Dubbo Filters are pluggable, allowing us to insert any type and number of filters into a single RPC request.&lt;/p>
&lt;p>The working principle of filters is illustrated in the diagram below:&lt;/p>
&lt;img style="max-width:800px;height:auto;" src="https://deploy-preview-3202--dubbo.netlify.app/imgs/v3/tasks/framework/filter.png"/>
&lt;h2 id="usage">Usage&lt;/h2>
&lt;h3 id="1-concept-of-filter-interceptor">1. Concept of Filter Interceptor&lt;/h3>
&lt;p>Filter is defined as follows:&lt;/p></description></item></channel></rss>