Module confluent.cavroserdes

ballerinax/confluent.cavroserdes Ballerina library

0.2.1

Overview

Avro Serializer/Deserializer for Confluent Schema Registry is an Avro serializer/deserializer designed to work with the Confluent Schema Registry. It is designed to not include the message schema in the message payload but instead includes the schema ID.

The Ballerina Avro Serializer/Deserializer for Confluent Schema Registry connector integrates with the Confluent Schema Registry for Avro serialization and deserialization.

Quickstart

To use the Confluent schema registry connector in your Ballerina project, modify the .bal file as follows.

Step 1: Import the module

Import the ballerinax/confluent.cavroserdes module into your Ballerina project.

Copy
import ballerinax/confluent.cavroserdes;

Step 2: Invoke the connector operation

You can now utilize the operations available within the connector. To instantiate a cregistry:Client instance refer to the guidelines here.

Copy
public function main() returns error? {
   cregistry:Client registry = ; // instantiate a schema registry client

   string schema = string `
      {
         "type": "int",
         "name" : "value", 
         "namespace": "data"
      }`;

   int value = 1;
   byte[] bytes = check cavroserdes:serialize(registry, schema, value, "subject");
   int number = check cavroserdes:deserialize(registry, bytes);
}

Step 3: Run the Ballerina application

Use the following command to compile and run the Ballerina program.

Copy
bal run

Examples

The Ballerina Avro Serializer/Deserializer connector for Confluent Schema Registry provides practical examples illustrating usage in various scenarios. Explore these examples.

  1. Kafka Avro producer - This example demonstrates how to publish Avro serialized data to a Kafka topic.

  2. Kafka Avro consumer - This guide demonstrates how to consume data in the correct format according to the Avro schema from a Kafka topic.

Import

import ballerinax/confluent.cavroserdes;Copy

Metadata

Released date: about 1 month ago

Version: 0.2.1

License: Apache-2.0


Compatibility

Platform: java17

Ballerina version: 2201.10.0

GraalVM compatible: Yes


Pull count

Total: 51

Current verison: 4


Weekly downloads


Source repository


Keywords

confluent

schema_registry

avro

serdes


Contributors

Other versions