davsclaus commented on issue #3183:
URL:
https://github.com/apache/camel-kamelets/issues/3183#issuecomment-6953156709
## Spike result: a Kamelet template cannot do this alone
I tested this with Camel JBang 4.24.0-SNAPSHOT and a small test Kamelet.
**1. Choosing a value from the vendor.** The idea was to pick the serde
class from hidden Kamelet properties, such as `serde-confluent-avro`, with a
nested placeholder. That does not work. A template with
`{{serde-{{vendor}}-{{format}}}}` fails to load:
```
FailedToCreateRouteException ...
SetBody[constant{nested={{serde-{{vendor}}-{{format}}}}}] ...
IllegalArgumentException: Missing {{ from the text: }}
```
Hidden properties would also show up as options in the catalog and the
tools, which is the clutter this is meant to remove.
**2. Choosing the dependencies from the vendor.** That does not work either.
A dependency such as `mvn:org.apache.commons:commons-{{lib}}:1.27.1` is not
resolved; it is downloaded literally and fails:
```
Could not find artifact org.apache.commons:commons-{{lib}}:jar:1.27.1 in
central
```
So a Kamelet cannot bring in only the jars of the vendor that was chosen. It
would have to list the jars of every vendor for every user.
**3. The Confluent serdes.**
- They are **not on Maven Central**, only in Confluent's own repository
(`packages.confluent.io/maven`). A Kamelet dependency is resolved from Central,
so it would need an extra repository configured.
- Licences of version 8.0.0:
| Artifact | Licence |
|---|---|
| `kafka-avro-serializer`, `kafka-schema-registry-client` | Apache License
2.0 |
| `kafka-json-schema-serializer`, `kafka-protobuf-serializer` and their
providers | Confluent Community License and Apache License 2.0 |
| Their parent POM | Confluent Community License and Apache License 2.0 |
The licences of their transitive dependencies would need a check too.
## What could work
**A. Support in camel-kafka (recommended).** The component would get options
such as `schemaRegistryVendor` (`confluent`, `apicurio`, `azure`) and
`schemaFormat` (`avro`, `json`, `protobuf`).
- **Serde classes and registry properties:** the component sets them itself.
They are class names as strings, so camel-kafka needs no compile dependency on
any vendor.
- **Kamelet options:** the Kafka Kamelets pass them through as optional
options (`schemaRegistry`, `schemaRegistryUrl`, `schemaFormat`). An unset
optional placeholder drops the parameter, so nothing changes for users without
a registry.
- **The vendor's jars:** they come from the runtime, not from the Kamelet.
For example, Camel JBang's dependency detection could add them from the option
value, as it already does for components. Confluent's own repository would have
to be among the repositories the runtime uses.
This also helps Kafka routes that do not use a Kamelet.
**B. One Kamelet per vendor**, such as `kafka-confluent-source` and
`kafka-confluent-sink`, each with fixed dependencies. That works today, but
means two to four more Kafka Kamelets per vendor, against the goal of a few.
The Confluent findings are relevant to #3182 too.
_Claude Code on behalf of Claus Ibsen_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]