Avro

This article introduces Avro serialization

1 Introduction

Avro is a remote procedure call and data serialization framework developed within the Apache Hadoop project. It uses JSON to define data types and communication protocols, and a compact binary format to serialize data. It is primarily used with Hadoop, providing a serialization format for persistent data and serving as a protocol for communication between Hadoop nodes and from client programs to Hadoop services.

2 Usage

2.1 Add Dependency

  1. <dependencies>
  2. <dependency>
  3. <groupId>org.apache.dubbo.extensions</groupId>
  4. <artifactId>dubbo-serialization-avro</artifactId>
  5. <version>3.3.0</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>org.apache.avro</groupId>
  9. <artifactId>avro</artifactId>
  10. <version>1.11.1</version>
  11. </dependency>
  12. </dependencies>

2.2 Configuration Enable

  1. # application.yml (Spring Boot)
  2. dubbo:
  3. protocol:
  4. serialization: avro

or

  1. # dubbo.properties
  2. dubbo.protocol.serialization=avro
  3. # or
  4. dubbo.consumer.serialization=avro
  5. # or
  6. dubbo.reference.com.demo.DemoService.serialization=avro

or

  1. <dubbo:protocol serialization="avro" />
  2. <!-- or -->
  3. <dubbo:consumer serialization="avro" />
  4. <!-- or -->
  5. <dubbo:reference interface="xxx" serialization="avro" />

Feedback

Was this page helpful?

Yes No

Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)