Resolve Schema Action
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Attaches an Avro, Protobuf or JSON schema to each message, for the later steps that need one, and leaves the body unchanged.
Use it to give the schema once, before data-type-action with a format such as avro-binary or protobuf-binary, which takes its schema only from here. avro-serialize-action, avro-deserialize-action, protobuf-serialize-action and protobuf-deserialize-action use it too when their own schema is not set.
Input: any body. The schema comes from schema, or else from the Java class named by contentClass.
Output: the body and the headers are unchanged. The schema is kept with the message in the properties X-Content-Schema and X-Content-Schema-Type (avsc, proto or json), which are not headers and are not sent to other systems.
Good to know: with the default mimeType, application/json, and no schema or contentClass, it does nothing. A mimeType it does not know makes every message fail with "Unsupported type".
Configuration Options
The following table summarizes the configuration options available for the resolve-pojo-schema-action Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Content Class | The full name of a Java class in the application whose fields define the schema. Only used when | string | com.example.Order | ||
MIME Type | Which kind of schema | string | application/json | avro/binary | |
Schema | The schema itself: for Avro, JSON text such as the example; for Protobuf, a | string | {"type": "record", "namespace": "com.example", "name": "FullName", "fields": [{"name": "first", "type": "string"},{"name": "last", "type": "string"}]} | ||
Target MIME Type | The kind of schema to find, as in | string | avro/binary |
Dependencies
At runtime, the resolve-pojo-schema-action Kamelet relies upon the presence of the following dependencies:
-
camel:kamelet
-
camel:jackson3-avro
-
camel:jackson3-protobuf
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:resolve-pojo-schema-action"
parameters:
.
.
.
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml