Description and usage of AvroschemaRegistry:

Provides a service for registering and accessing schemas. You can register a schema as a dynamic property where ‘name’ represents the schema name and ‘value’ represents the textual representation of the actual schema following the syntax and semantics of Avro’s Schema format.

Tags:

schema, registry, avro, json, csv

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values.

Name

Default Value

Allowable Values

Description

Validate Field Names

true * true
* false
Whether or not to validate the field names in the Avro schema based on Avro naming rules. If set to true, all field names must be valid Avro names, which must begin with [A-Za-z_], and subsequently contain only [A-Za-z0-9_]. If set to false, no validation will be performed on the field names.

State management:

This component does not store state.

Restricted:

This component is not restricted.

Configuration of Avro Schema Controller Service

Avro schema is created in JSON document format, which is a lightweight, text-based data interchange format. It is created in one of the following ways:

  • JSON string
  • JSON object
  • JSON Array

Primitive data types of Avro

Data type

Description

Null Null is a type having no value.
int 32-bit signed integer.
long 64-bit signed integer.
float Single precision (32-bit) IEEE 754 floating-point number.
double Double precision (64-bit) IEEE 754 floating-point number.
bytes Sequence of 8-bit unsigned bytes.
string Unicode character sequence.

Complex data types of Avro
Along with primitive data types, Avro provides six complex data types such as Records, Enum, Arrays, Maps, Unions, and Fixed.

For example, When you convert the response from one format into another, specify the Avro schema in AvroSchemaRegistry controller service to get the output response in which type you needed.

Consider you have employee details in Avro format response, it can be converted into JSON by using the following schema.

{
	"type" : "record",
	"namespace" : "EmployeeDetails",
	"name" : "Employee",
	"fields" : [
  		{ "name" : "Name" , "type" : "string" },
  		{ "name" : "Age" , "type" : "int" }
	]
}

In the previous example:

  • Type: Describes document types, in this case a "record" is a document type.
  • Namespace: Describes the name of the namespace in which the object resides.
  • Name: Describes the schema name.
  • Fields: This is an attribute array which contains the attributes for your response.
    • In this case, name and type are the name and data type of the corresponding fields.

For the following scenarios, AvroSchemaRegistry controller service is needed:

  • For converting Avro format response into JSON format.
  • For converting CSV format response into JSON format.

Possible controller services in which AvroSchemaRegistry can be used:

Possible processors in which AvroSchemaRegistry can be used:

Configure AvroSchemaRegistry controller service

  1. In controller service dialog, create a new controller service using Add icon.
    Create a new controller service

  2. Search and add AvroSchemaRegistry controller service.
    Search and add

  3. Click configure icon to add schema to the output response.
    Add schema to the output response

  4. Add the dynamic property and required schema as value for this property. Refer to the following screenshot.
    Add the dynamic property and required schema as value for this property

  5. After configuring the previous steps, enable the controller service. Refer to the following screenshot.
    Enable the controller service