Federico Mariani created CAMEL-27065:
----------------------------------------
Summary: camel-core - a to with a Simple expression in its
endpoint uri sends to the literal endpoint without any warning
Key: CAMEL-27065
URL: https://issues.apache.org/jira/browse/CAMEL-27065
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Federico Mariani
A {{to}} resolves its endpoint once, when the route is created. A Simple
expression in the path of its uri is not evaluated: every message goes to one
endpoint named by the text of the expression. The route starts without any
warning, so the mistake shows only as messages in the wrong place.
{code:java}
from("direct:start")
.to("jms:queue:orders-${header.region}"); // every message goes to the
queue "orders-${header.region}"
{code}
The same with {{to("mock:out-$\{header.id\}")}}: {{mock:out-1}} is never
created, and {{mock://out-$%7Bheader.id%7D}} gets every message. {{camel
validate}} and the YAML DSL validator already report this (CAMEL-24917,
CAMEL-25208), but nothing does at runtime, for routes that are not validated.
Expected: when the route is created, Camel logs a WARN for such a {{to}} that
says to use {{toD}}. The route works as before. The rule is the one of the
offline checks: only the path is looked at, not the options after the {{?}},
and the components that evaluate their path for each message are left alone
({{language}}, the {{:#$\{...\}}} parameters of {{sql}}, and the components
whose path option has {{supportSimpleExpression}} in their metadata, such as
{{micrometer}}). The template of {{sql-stored}} ({{sql-stored:MYFUNC(INTEGER
$\{header.num\})}}) and the bucket name of {{aws2-s3}} are evaluated for each
message too, but their metadata does not say so yet: they get
{{supportSimpleExpression}}, which also keeps {{camel validate}} from reporting
them.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)