apache / camel-kamelets

Apache Camel Kamelets Repository
https://camel.apache.org
Apache License 2.0
55 stars 79 forks source link

pulsar-sink invalid character handling #2249

Open tincore opened 1 month ago

tincore commented 1 month ago

Thanks for all the great work.

Running

JBang version: 0.117.1
Camel JBang version: 4.8.0

I'm not sure if this is expected but it seems like having invalid characters in uri parameters could be a bit unintuitive. I'm not sure if this would be the case with all kamelets or just this one. I've checked pulsar component sources and I could not find anything odd there.

This works (pulsar component). RAW() has to be added otherwise "pulsar+ssl" is parsed as "pulsar ssl" which would be invalid.

        - to: pulsar:persistent://tenant1/namespace1/topic1?serviceUrl=RAW(pulsar+ssl://localhost:1234)

When using pulsar-sink the following snippet fails because serviceUrl seems to be parsed when used in the kamelet and then in the pulsar component.

        - to:
            uri: kamelet:pulsar-sink
            parameters:
              topicType: persistent
              tenant: mytenant
              topic: mytopic
              namespaceName: mynamespace
              serviceUrl: RAW(pulsar+ssl://localhost:1234)
Caused by: java.net.URISyntaxException: Illegal character in scheme name at index 6: pulsar ssl://localhost:1234

A workaround for this seems to be nesting RAW twice. Do you know if there is any other option? To me this seems unintuitive because you would need to know the template nesting level in order to add enough RAWs in an attribute with 'invalid' characters.

        - to:
            uri: kamelet:pulsar-sink
            parameters:
              topicType: persistent
              tenant: mytenant
              topic: mytopic
              namespaceName: mynamespace
              serviceUrl: RAW(RAW(pulsar+ssl://localhost:1234))