Dhairya-007 opened a new pull request, #29977:
URL: https://github.com/apache/camel/pull/29977

   ## Problem
   
   ```java
   @Metadata(label = "producer", description = "Job key for the worker job", 
javaType = "long")
   public static final String JOB_KEY = HEADER_PREFIX + "JobKey";
   ```
   
   The job worker consumer puts the key of every job it activates on the 
exchange:
   
   ```java
   exchange.getMessage().setHeader(CamundaConstants.JOB_KEY, job.getKey());
   ```
   
   and `JobProcessor`, which serves the `completeJob`, `failJob`, `throwError` 
and `updateJobRetries` producer operations, reads it back when the body does 
not carry a job key of its own:
   
   ```java
   Long headerJobKey = 
exchange.getMessage().getHeader(CamundaConstants.JOB_KEY, Long.class);
   Object body = exchange.getMessage().getBody();
   ...
   } else if (headerJobKey != null) {
       message = buildFromHeaders(exchange, headerJobKey);
   }
   ...
   if (message.getJobKey() == 0 && headerJobKey != null) {
       // a body without a jobKey: use the job key of the header
       message.setJobKey(headerJobKey);
   ```
   
   So this header is what joins the two halves of the usual route - worker 
consumer, processing, `completeJob` producer - and `label = "producer"` with 
"Job key for the worker job" documents only the half that reads it. Nothing in 
the consumer's header table says the key arrives this way, which is the one 
thing a route needs to know to complete the job afterwards.
   
   ## Fix
   
   Drop the label so the header lands in `common`, and say what it holds in 
each direction:
   
   > (consumer) Job key of the worker job that was activated. (producer) Job 
key of the job to act on, when the body does not carry one.
   
   No header name, type or behaviour changes. The regenerated `camunda.json` 
files are included.


-- 
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]

Reply via email to