[ 
https://issues.apache.org/jira/browse/CAMEL-27852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27852:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-camunda for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/f9e89282ea330ac399422c39806c46d8db9c4777,
 pull request https://github.com/apache/camel/pull/31144).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The error headers are ignored for a job worker body
In {{JobProcessor.process}} a JobWorkerMessage body becomes a JobRequest with 
only the job key, so CamelCamundaErrorCode and CamelCamundaErrorMessage are 
ignored. The documented "Throw a business error" example passes errorCode=null; 
the protobuf setErrorCode(null) throws NullPointerException and the exchange 
fails with "Camunda operation throwError failed: null". The same branch sends 
failJob with retries=0 (an incident) and completeJob without variables.
Proposed change: build the request with buildFromHeaders(exchange, 
jobWorkerMessage.getKey()).

h4. 2. A JSON body is ignored when the job key header is set
With CamelCamundaJobKey set and a JSON byte[] or InputStream body, the header 
branch runs before the JSON fallback, and only a Map body counts as variables.
Proposed change: check the header first only for a Map or null body.

h4. 3. failJob through headers always sends retries 0
No header sets retries, so an explicit failJob always creates an incident.
Proposed change: add a retries header, or use job.getRetries() - 1 as the 
consumer does.

h4. 4. deployResource error code is always null
The failure path sets CamelCamundaErrorCode from 
DeploymentResponse.getErrorCode(), which CamundaService never fills.
Proposed change: fill it or drop it.

h4. 5. No option for the OAuth audience
{{CamundaComponent.buildClient}} sends grpcAddress as the OAuth token audience, 
with no option to change it; only the CAMUNDA_TOKEN_AUDIENCE environment 
variable works. Identity providers other than Keycloak need a real audience.
Proposed change: add an oAuthAudience option.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-camunda for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31144).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The error headers are ignored for a job worker body
In {{JobProcessor.process}} a JobWorkerMessage body becomes a JobRequest with 
only the job key, so CamelCamundaErrorCode and CamelCamundaErrorMessage are 
ignored. The documented "Throw a business error" example passes errorCode=null; 
the protobuf setErrorCode(null) throws NullPointerException and the exchange 
fails with "Camunda operation throwError failed: null". The same branch sends 
failJob with retries=0 (an incident) and completeJob without variables.
Proposed change: build the request with buildFromHeaders(exchange, 
jobWorkerMessage.getKey()).

h4. 2. A JSON body is ignored when the job key header is set
With CamelCamundaJobKey set and a JSON byte[] or InputStream body, the header 
branch runs before the JSON fallback, and only a Map body counts as variables.
Proposed change: check the header first only for a Map or null body.

h4. 3. failJob through headers always sends retries 0
No header sets retries, so an explicit failJob always creates an incident.
Proposed change: add a retries header, or use job.getRetries() - 1 as the 
consumer does.

h4. 4. deployResource error code is always null
The failure path sets CamelCamundaErrorCode from 
DeploymentResponse.getErrorCode(), which CamundaService never fills.
Proposed change: fill it or drop it.

h4. 5. No option for the OAuth audience
{{CamundaComponent.buildClient}} sends grpcAddress as the OAuth token audience, 
with no option to change it; only the CAMUNDA_TOKEN_AUDIENCE environment 
variable works. Identity providers other than Keycloak need a real audience.
Proposed change: add an oAuthAudience option.


_Claude Code on behalf of davsclaus_


> camel-camunda: the throwError example fails because the error headers are 
> ignored for a job worker body, failJob always sends retries 0
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27852
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27852
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-camunda for 
> CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/f9e89282ea330ac399422c39806c46d8db9c4777,
>  pull request https://github.com/apache/camel/pull/31144).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. The error headers are ignored for a job worker body
> In {{JobProcessor.process}} a JobWorkerMessage body becomes a JobRequest with 
> only the job key, so CamelCamundaErrorCode and CamelCamundaErrorMessage are 
> ignored. The documented "Throw a business error" example passes 
> errorCode=null; the protobuf setErrorCode(null) throws NullPointerException 
> and the exchange fails with "Camunda operation throwError failed: null". The 
> same branch sends failJob with retries=0 (an incident) and completeJob 
> without variables.
> Proposed change: build the request with buildFromHeaders(exchange, 
> jobWorkerMessage.getKey()).
> h4. 2. A JSON body is ignored when the job key header is set
> With CamelCamundaJobKey set and a JSON byte[] or InputStream body, the header 
> branch runs before the JSON fallback, and only a Map body counts as variables.
> Proposed change: check the header first only for a Map or null body.
> h4. 3. failJob through headers always sends retries 0
> No header sets retries, so an explicit failJob always creates an incident.
> Proposed change: add a retries header, or use job.getRetries() - 1 as the 
> consumer does.
> h4. 4. deployResource error code is always null
> The failure path sets CamelCamundaErrorCode from 
> DeploymentResponse.getErrorCode(), which CamundaService never fills.
> Proposed change: fill it or drop it.
> h4. 5. No option for the OAuth audience
> {{CamundaComponent.buildClient}} sends grpcAddress as the OAuth token 
> audience, with no option to change it; only the CAMUNDA_TOKEN_AUDIENCE 
> environment variable works. Identity providers other than Keycloak need a 
> real audience.
> Proposed change: add an oAuthAudience option.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to