Thrift Protocol

Thrift Protocol

The Thrift protocol currently supported by Dubbo is an extension of the native Thrift protocol 1, adding some extra header information on top of the base protocol, such as service name, magic number, etc.

Using the Dubbo Thrift protocol also requires the Thrift IDL compiler to compile and generate the corresponding Java code. Future versions will enhance this aspect.

Dependencies

<dependency>
    <groupId>org.apache.thrift</groupId>
    <artifactId>libthrift</artifactId>
    <version>0.8.0</version>
</dependency>

Configuration

All services share a common port 2:

<dubbo:protocol name="thrift" port="3030" />

Usage

Refer to the example code in the Dubbo project

Frequently Asked Questions

  • Thrift does not support null values, meaning: null values cannot be passed in the protocol.

  1. Thrift is an RPC framework donated by Facebook to Apache. ↩︎

  2. Not compatible with native Thrift. ↩︎