<?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-3229--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-3229--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-3229--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-3229--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/streaming/</guid><description>&lt;p>Sample source: &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/streaming" target="_blank">dubbo-go-samples/streaming&lt;/a>.&lt;/p>
&lt;p>A unary RPC has one request and one response. Triple streaming allows a single RPC to carry a sequence of messages, which is useful for chunked data, server push, and real-time communication.&lt;/p>
&lt;h2 id="streaming-types">Streaming types&lt;/h2>
&lt;p>In a &lt;code>.proto&lt;/code> method, the side marked with &lt;code>stream&lt;/code> can send more than one message:&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th style="text-align: left">Type&lt;/th>
 &lt;th style="text-align: right">Requests&lt;/th>
 &lt;th style="text-align: right">Responses&lt;/th>
 &lt;th style="text-align: left">Definition&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td style="text-align: left">Server streaming&lt;/td>
 &lt;td style="text-align: right">1&lt;/td>
 &lt;td style="text-align: right">N&lt;/td>
 &lt;td style="text-align: left">&lt;code>rpc Method(Request) returns (stream Response)&lt;/code>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">Client streaming&lt;/td>
 &lt;td style="text-align: right">N&lt;/td>
 &lt;td style="text-align: right">1&lt;/td>
 &lt;td style="text-align: left">&lt;code>rpc Method(stream Request) returns (Response)&lt;/code>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td style="text-align: left">Bidirectional streaming&lt;/td>
 &lt;td style="text-align: right">N&lt;/td>
 &lt;td style="text-align: right">N&lt;/td>
 &lt;td style="text-align: left">&lt;code>rpc Method(stream Request) returns (stream Response)&lt;/code>&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;p>Server streaming works well for event push and large downloads. Client streaming is commonly used for chunked uploads or server-side aggregation. In a bidirectional stream, sending and receiving are independent, making it suitable for chat and real-time control. The sample echoes each request immediately, but that is an application choice rather than a protocol requirement.&lt;/p></description></item><item><title>Timeout Duration</title><link>https://deploy-preview-3229--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-3229--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-3229--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-3229--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>Related samples:&lt;/p></description></item><item><title>Exception Type Return Values</title><link>https://deploy-preview-3229--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-3229--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-3229--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-3229--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-3229--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-3229--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-3229--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-3229--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/attachments/</guid><description>&lt;p>Dubbo-go provides two related ways to pass metadata outside the RPC request and response body:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Attachments&lt;/strong> are Dubbo RPC implicit parameters. They are stored in &lt;code>context&lt;/code> under &lt;code>constant.AttachmentKey&lt;/code> and are commonly used by filters, routing, tracing, or business code that needs request-scoped key-value data. For Triple calls, request attachments are carried as HTTP metadata headers. For Dubbo protocol calls, attachments are encoded in a fixed location in the protocol body.&lt;/li>
&lt;li>&lt;strong>Triple metadata headers and trailers&lt;/strong> are Triple protocol metadata APIs exposed as &lt;code>http.Header&lt;/code>. They are useful when application code needs direct access to request metadata or response header/trailer data.&lt;/li>
&lt;/ul>
&lt;p>Sample source code:&lt;/p></description></item><item><title>Startup check</title><link>https://deploy-preview-3229--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-3229--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>OpenAPI Documentation Generation &amp; Management</title><link>https://deploy-preview-3229--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/openapi/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://deploy-preview-3229--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/openapi/</guid><description>&lt;p>Dubbo-go provides built-in OpenAPI support that automatically generates OpenAPI 3.0-compliant API documentation for Triple protocol services, with Swagger UI and ReDoc for visual API browsing and debugging.&lt;/p>
&lt;p>Sample source: &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/rpc/triple/openapi" target="_blank">dubbo-go-samples/rpc/triple/openapi&lt;/a>.&lt;/p>
&lt;h2 id="feature-overview">Feature Overview&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Automatic Documentation Generation&lt;/strong>: Automatically generates OpenAPI 3.0.1 API documentation based on service interface definitions (protobuf IDL or non-IDL mode)&lt;/li>
&lt;li>&lt;strong>Swagger UI&lt;/strong>: Built-in Swagger UI interface for online API browsing and debugging&lt;/li>
&lt;li>&lt;strong>ReDoc&lt;/strong>: Built-in ReDoc interface for clean API documentation presentation&lt;/li>
&lt;li>&lt;strong>Multiple Output Formats&lt;/strong>: Supports both JSON and YAML output formats&lt;/li>
&lt;li>&lt;strong>Group Management&lt;/strong>: Supports organizing services into OpenAPI Groups for managing multiple API versions&lt;/li>
&lt;li>&lt;strong>Static Documentation Generation&lt;/strong>: Generate static OpenAPI documentation files at compile time from &lt;code>.proto&lt;/code> files using the &lt;code>protoc-gen-triple-openapi&lt;/code> plugin&lt;/li>
&lt;/ul>
&lt;h2 id="quick-start">Quick Start&lt;/h2>
&lt;h3 id="1-enable-openapi">1. Enable OpenAPI&lt;/h3>
&lt;p>Enable OpenAPI through the Triple protocol options when creating a Server:&lt;/p></description></item><item><title>Filter Interceptor</title><link>https://deploy-preview-3229--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-3229--dubbo.netlify.app/en/overview/mannual/golang-sdk/tutorial/rpc/filter/</guid><description>&lt;p>Sample source: &lt;a href="https://github.com/apache/dubbo-go-samples/tree/main/filter" target="_blank">dubbo-go-samples/filter&lt;/a>.&lt;/p>
&lt;p>Filters dynamically intercept requests or responses to transform or utilize the information contained in them. A filter
does not usually create a response by itself. Instead, it provides reusable logic that can be attached to RPC calls.
Dubbo filters are pluggable, so you can compose multiple filters into one consumer or provider invocation chain.&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-3229--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>