Module confluent.cavroserdes
ballerinax/confluent.cavroserdes Ballerina library
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.
import ballerinax/confluent.cavroserdes;
Step 2: Instantiate a new connector
configurable string baseUrl = ?; configurable int identityMapCapacity = ?; configurable map<anydata> originals = ?; configurable map<string> headers = ?; cavroserdes:Client avroSerDes = check new ({ baseUrl, identityMapCapacity, originals, headers });
Step 3: Invoke the connector operation
You can now utilize the operations available within the connector.
public function main() returns error? { string schema = string ` { "type": "int", "name" : "value", "namespace": "data" }`; int value = 1; byte[] bytes = check avroSerDes->serialize(schema, value, "subject"); int number = check avroSerDes->deserialize(bytes); }
Step 4: Run the Ballerina application
Use the following command to compile and run the Ballerina program.
bal run
Import
import ballerinax/confluent.cavroserdes;
Other versions
0.1.0