Cameleer

Azure Schema Registry component

The azure-schema-registry component registers and looks up Avro, JSON and custom schemas in the Azure Event Hubs Schema Registry.

Scheme: azure-schema-registry: · Crate: cameleer-cloud · Cargo feature: cloud · Consumer: no · Producer: yes · Apache Camel: none (Apache Camel offers the registry only as a Kafka serializer library; this is a Cameleer component)

When to use it

  • Register the schema of the events a route produces, as part of a deployment.
  • Look up a schema by id when a message carries only the schema id.
  • List the versions of a schema for compatibility checks.

URI format

text
azure-schema-registry://namespace/group[?options]

namespace is the Event Hubs namespace (myns means https://myns.servicebus.windows.net, or give a fully qualified name); group is the schema group.

Example

Register an Avro schema when the route starts:

yaml example: azure-schema-registry-register
- route:
    id: register-order-schema
    from:
      uri: "timer:register-schema?repeatCount=1"
      steps:
        - setBody:
            constant: '{"type":"record","name":"Order","namespace":"com.example","fields":[{"name":"id","type":"string"},{"name":"total","type":"double"}]}'
        - to: "azure-schema-registry://{{env:EVENTHUBS_NAMESPACE:my-namespace}}/orders?operation=registerSchema&schemaName=com.example.Order&tenantId={{env:AZURE_TENANT_ID:}}&clientId={{env:AZURE_CLIENT_ID:}}&clientSecret=RAW({{env:AZURE_CLIENT_SECRET:}})"
        - log: "schema id ${body}, version ${header.CamelAzureSchemaRegistrySchemaVersion}"
        - to: "log:schemas"

Rust DSL

rust
ctx.add_routes(|b| {
    b.from("timer:register-schema?repeatCount=1")
        .set_body(constant(r#"{"type":"record","name":"Order","namespace":"com.example","fields":[{"name":"id","type":"string"},{"name":"total","type":"double"}]}"#))
        .to("azure-schema-registry://{{env:EVENTHUBS_NAMESPACE:my-namespace}}/orders?operation=registerSchema&schemaName=com.example.Order&tenantId={{env:AZURE_TENANT_ID:}}&clientId={{env:AZURE_CLIENT_ID:}}&clientSecret=RAW({{env:AZURE_CLIENT_SECRET:}})")
        .log("schema id ${body}, version ${header.CamelAzureSchemaRegistrySchemaVersion}")
        .to("log:schemas");
})?;

Options

optiondefaultdescription
operationgetSchemaregisterSchema, getSchemaProperties (id of the body's definition), getSchema (by id), getSchemaByVersion, listVersions, listGroups.
schemaNameSchema name.
schemaIdSchema id of getSchema.
formatAvroAvro, Json or Custom.
credentialTypeCLIENT_SECRETCLIENT_SECRET (tenantId, clientId, clientSecret, authorityHost) or AZURE_IDENTITY.
uriEndpointOverride, proxyHost, proxyPort, trustAllCertificatesConnection settings.

Message headers

headerdirectiondescription
CamelAzureSchemaRegistryOperationinOverrides operation.
CamelAzureSchemaRegistrySchemaName, CamelAzureSchemaRegistryFormatin/outName and format.
CamelAzureSchemaRegistrySchemaIdin/outSchema id.
CamelAzureSchemaRegistrySchemaVersionin/outVersion (input of getSchemaByVersion).
CamelAzureSchemaRegistrySchemaGroupoutGroup of the schema.

Run it with Docker

sh
docker run --rm -e EVENTHUBS_NAMESPACE -e AZURE_TENANT_ID -e AZURE_CLIENT_ID -e AZURE_CLIENT_SECRET \
  -v "$PWD:/routes:ro" pmsudhi/cameleer run /routes/schemas.camel.yaml

Common questions

Does it serialize Kafka or Event Hubs messages?

No. It manages schemas through the REST API; serialize with the avro or json data formats and use the schema id in a header.

Found a problem?

If something on this page doesn't match what Cameleer does, or you hit a bug while building with it, please help fix it, whether you are a person or a coding agent: open an issue that describes what you saw, then fork the repository, fix it, add or update a test, run cargo test --workspace, and open a pull request. CONTRIBUTING.md explains the ground rules.

Edit this page on GitHub