10 Ocak 2022 Pazartesi

Apache Thrift - Protobuf Muadili

Giriş
Facebook tarafından yaratıldı.
Maven
Şu satırı dahil ederiz
<dependency>
  <groupId>org.apache.thrift</groupId>
  <artifactId>libthrift</artifactId>
  <version>0.15.0</version>
</dependency>

Apache Thrift ve Protocol Buffers
Designing Data Intensive Applications kitabından bazı cümleler şöyle. 
Apache Thrift and Protocol Buffers (protobuf) are binary encoding libraries that are based on the same principle. Protocol Buffers was originally developed at Google, Thrift was originally developed at Facebook, and both were made open source in 2007–08.
Both Thrift and Protocol Buffers require a schema for any data that is encoded.

Thrift and Protocol Buffers each come with a code generation tool that takes a schema definition like the ones shown here, and produces classes that implement the schema in various programming languages. Your application code can call this generated code to encode or decode records of the schema.

Tipler
Açıklaması şöyle
Base types for Thrift are :
- bool value boolean value, true or false
- byte value signed byte
- i16 value 16-bit signed integer
- i32 value 32-bit signed integer
- i64 value 64-bit signed integer
- double value 64-bit floating-point number
- string text/binary string

The other types are Structs, Containers, Exceptions, Services
thrift komutu
-r seçeneği
Örnek
Şöyle yaparız
thrift-0.15.0 -r — gen java studentservice.thrift