Bruno Meseguer created CAMEL-21928:
--------------------------------------

             Summary: include variable() and body() as new functions to access 
in-process data
                 Key: CAMEL-21928
                 URL: https://issues.apache.org/jira/browse/CAMEL-21928
             Project: Camel
          Issue Type: Improvement
          Components: camel-jq
            Reporter: Bruno Meseguer


According to the documentation here:
 * 
[https://camel.apache.org/components/next/languages/jq-language.html#_camel_supplied_jq_functions]

The Camel JQ component includes functions to access:
 * headers
 * properties

However, now Camel includes variables, which is the recommended way to keep 
process data in context. 

As variables are not supported, users are obligated to set headers or 
properties in order to access in-process data.

Another desirable function to have is 'body()'. At first, it seems unnecessary 
because a JQ expression would operate against the message body by default. 
However, you might want to define the expression to use a variable as the 
source, and then need to access the body (not possible at the moment).

To illustrate the need, see the YAML below, where you might want to use JQ to 
modify a variable, and use data from the body like this:

 
{code:java}
- setVariable:
    name: mydata
    expression:
      jq:
        source: mydata
        expression: '. + [{"response1": body()}]'{code}
For clarity, the code above reads the variable "mydata" that contains a JSON 
array, the expression adds a new entry "response1" with the value from the body.

To summarise the need, please include:
 * new function {*}variable(){*}, for example to do variable("mydata")
 * new function *body()*

 

 



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

Reply via email to