davsclaus commented on code in PR #25992:
URL: https://github.com/apache/camel/pull/25992#discussion_r3902309378
##########
components/camel-dynamic-router/src/main/java/org/apache/camel/component/dynamicrouter/control/DynamicRouterControlProducer.java:
##########
@@ -74,29 +75,57 @@ public DynamicRouterControlProducer(final
DynamicRouterControlEndpoint endpoint,
this.configuration = configuration;
}
+ /**
+ * Returns the value to use for a predicate parameter that a control
message may try to supply. Unless the endpoint
+ * explicitly allows the predicate to come from the message, a
message-supplied value is rejected, and the value
+ * configured on the endpoint is used instead. Without this, the sender of
a control message would choose both the
+ * expression language and the expression that the Dynamic Router compiles
into a live predicate.
+ *
+ * @param allowFromMessage whether the endpoint allows the predicate to
come from the control message
+ * @param messageValue the value found in the control message, if any
+ * @param configValue the value configured on the endpoint
+ * @return the value to use
+ */
+ static String predicateValueToUse(
+ final boolean allowFromMessage, final String messageValue, final
String configValue) {
Review Comment:
Non-blocking question: when `allowFromMessage` is `true` and the message
simply doesn't supply a predicate/expressionLanguage, this returns
`messageValue` (null/empty) directly rather than falling back to `configValue`.
That then falls through to the legacy
`subscribeWithPredicateInstance(message.getBody())` path rather than using the
endpoint-configured predicate.
This matches the pre-PR behavior for that specific combination, so it's not
a regression, but it does mean the PR's "endpoint fallback for the remaining
subscription parameters" only applies to `predicate`/`expressionLanguage` when
the gate is closed (`allowFromMessage=false`) — a deployment can't combine
"messages may override the predicate" with "otherwise fall back to the
endpoint's default predicate." Worth confirming this is the intended semantics,
since a reader of the PR description could expect the fallback to apply in both
gate states.
--
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]