Claus Ibsen created CAMEL-24931:
-----------------------------------

             Summary: camel-jsonpath, camel-jq: the null body hint says how to 
read the data, not only that it must be read
                 Key: CAMEL-24931
                 URL: https://issues.apache.org/jira/browse/CAMEL-24931
             Project: Camel
          Issue Type: Improvement
          Components: camel-jsonpath
            Reporter: Claus Ibsen


A route reached with {{direct:}} has the body of its caller. When the caller 
has none - a REST GET, a timer - a {{jsonpath}} or {{jq}} step in that route 
has nothing to read, and the message says to read the JSON first but not how:

{noformat}
The jsonpath expression got no message body to evaluate (the body is null): 
read the JSON before the step
with poll: file:..., pollEnrich or a from: consumer, or set it with setBody
{noformat}

"set it with setBody" is the answer for the common case - a file the route 
knows the name of - and it does not say what to put in the setBody. In the AI 
route benchmark this exact failure produced 24 exceptions per run over five 
runs, with the model reading the message every time and never adding the read, 
because the message names the mechanism and not the form.

The two hints now carry the rule and both forms:

{noformat}
The jsonpath expression got no message body to evaluate (the body is null): a 
route reached with direct: has
the body of its caller, so when the caller has none, read the data first - 
setBody with
constant: resource:file:data.json for a known file, or poll:, pollEnrich or a 
from: consumer for one that is not
{noformat}

Same wording in {{JqExpression}}. Related to CAMEL-24838, which added the 
original hint.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to