[
https://issues.apache.org/jira/browse/CAMEL-26119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136751#comment-18136751
]
Claus Ibsen commented on CAMEL-26119:
-------------------------------------
Claus decided on the open question of the PR: the camunda producer JSON uses
camelCase property names only, like Camunda itself (REST API v2 jobKey, the
Zeebe gateway proto and the Java client) and like the JSON of the worker
consumer.
The PR now renames all snake_case JSON names of the producer requests and
responses (process_id -> processId, job_key -> jobKey, error_message ->
errorMessage, ...), with no snake_case aliases. The job operations also read
the job key from the key property of the worker JSON, so that JSON can be sent
to completeJob as is. The 4.24 upgrade guide lists the renamed properties:
https://github.com/apache/camel/pull/28896
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-camunda - a JSON body as bytes or a stream is rejected as data missing,
> and a failed operation does not fail the exchange
> -------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26119
> URL: https://issues.apache.org/jira/browse/CAMEL-26119
> Project: Camel
> Issue Type: Bug
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of flowable, camunda and bonita
> (CAMEL-24961, PR #28418).
> h4. 1. A JSON body as bytes or a stream is rejected
> The producer processors accept JSON only when the body is a {{String}}:
> {{ProcessProcessor}} (main 2a465aa4814c, lines 43 and 52), {{JobProcessor}}
> (lines 44 and 58) and {{MessageProcessor}} (lines 39 and 47) check
> {{instanceof String}} and else throw "Process data missing" ("Job data
> missing", "Message data missing"). A JSON body as {{byte[]}} or an
> {{InputStream}}, as an HTTP consumer gives, is rejected although it converts
> to a String. Checked on 4.24.0-SNAPSHOT with a mocked {{CamundaService}}.
> Proposed: convert any other body to a String (when it can be) before parsing
> it as JSON.
> h4. 2. The consumer's JSON uses other property names than the producer's
> With {{formatJSON=true}} the consumer writes the {{JobWorkerMessage}} as JSON
> in camelCase with a {{variablesAsMap}} field ({{JobWorkerMessage}}, main
> 2a465aa4814c, line 42; {{CamundaConsumer}} line 106), while the producer
> reads and writes snake_case JSON ({{ProcessRequest}} line 32,
> {{process_id}}). So the JSON of a consumer cannot be sent to a producer as
> is. Checked on 4.24.0-SNAPSHOT with a mocked {{CamundaService}}.
> Proposed: use the same naming (snake_case, as documented) for the consumer's
> JSON.
> h4. 3. A failed operation does not fail the exchange
> {{CamundaService}} catches every exception of the Camunda client (main
> 2a465aa4814c, e.g. lines 85-89 for startProcess) and returns a response with
> {{success=false}} and the error message, so the exchange completes normally
> and the route goes on as if the operation had worked. Checked on
> 4.24.0-SNAPSHOT with a mocked {{CamundaService}}.
> Proposed: set the exception on the exchange when the operation fails (keeping
> the response in the body), or at least document that the
> {{CamelCamundaIsSuccess}} header must be checked.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)