christophd opened a new issue, #4777:
URL: https://github.com/apache/camel-k/issues/4777
### What happened?
When a Pipe uses a simple language expression (e.g. `${header[foo]}`) to set
a property value on a Kamelet (e.g. on insert-header-action Kamelet) the Pipe
fails because of property resolving errors.
Many Kamelets do support simple language expressions and this includes
`insert-header-action` Kamelet but the simple language syntax `${...}` causes
problems in property resolving mechanism on Camel K.
In general user defined properties on Kamelets are handled as
`user.properties` on the Integration and the `${...}` simple language
expression syntax collides with the general property resolving syntax.
This issue is only when running Pipes with Camel K. Camel JBang does not
report these errors.
The workaround for this is to use `$simple{...}` expression syntax in Pipes
when using Camel K.
### Steps to reproduce
Use something like this in Pipe:
```yaml
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: insert-header-action
properties:
name: kafka.OVERRIDE_TOPIC
value: ${header[topic]}
```
This workaround works as expected:
```yaml
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: insert-header-action
properties:
name: kafka.OVERRIDE_TOPIC
value: $simple{header[topic]}
```
### Relevant log output
```shell
Caused by: java.lang.IllegalArgumentException: Property with key [value] not
found in properties from text: {{value}}
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:369)
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:232)
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParseNested(DefaultPropertiesParser.java:169)
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:118)
at
org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:70)
at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:315)
at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:170)
at
org.apache.camel.impl.engine.DefaultCamelContextExtension.resolvePropertyPlaceholders(DefaultCamelContextExtension.java:230)
at
org.apache.camel.impl.engine.AbstractCamelContext.resolvePropertyPlaceholders(AbstractCamelContext.java:1566)
at
org.apache.camel.support.CamelContextHelper.parseText(CamelContextHelper.java:374)
at
org.apache.camel.reifier.AbstractReifier.parseString(AbstractReifier.java:58)
at
org.apache.camel.reifier.language.ExpressionReifier.createExpression(ExpressionReifier.java:161)
at
org.apache.camel.reifier.AbstractReifier.createExpression(AbstractReifier.java:119)
at
org.apache.camel.reifier.SetBodyReifier.createProcessor(SetBodyReifier.java:34)
at
org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:853)
at
org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:593)
at
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:213)
```
```
### Camel K version
2.0.1
--
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]