Abhitocode commented on code in PR #2241:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2241#discussion_r2227205142


##########
jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/main/java/org/kie/kogito/jobs/embedded/EmbeddedJobExecutor.java:
##########
@@ -142,6 +152,45 @@ private Uni<JobExecutionResponse> 
processJobDescription(JobDetails jobDetails, P
                         .build());
     }
 
+    private Uni<JobExecutionResponse> processJobDescription(JobDetails 
jobDetails, ProcessJobDescription processJobDescription) {
+        String processId = processJobDescription.processId();
+        Process<? extends Model> process = 
processes.get().processById(processId);
+
+        LOGGER.info("Processing processJobDescription for processId: {}, 
jobDetails: {}, processDescription: {}, and process: {}",
+                processId, jobDetails, processJobDescription, process);
+
+        if (Objects.isNull(process)) {
+            return Uni.createFrom().item(
+                    JobExecutionResponse.builder()
+                            .code("401")
+                            .jobId(jobDetails.getId())
+                            .now()
+                            .message("job does not belong to this container")
+                            .build());
+        }
+
+        Integer limit = jobDetails.getRetries();
+
+        Supplier<Boolean> execute = () -> 
executeInUnitOfWork(application.unitOfWorkManager(), () -> {
+            process.send(SignalFactory.of("timerTriggered", 
processJobDescription.expirationTime()));

Review Comment:
   @elguardian 
   As we dont have "timerId" for ProcessJobDescription like we have for 
ProcessInstanceJobDescription, I created TimerInstance using correlationId, 
limit and timerId where timerId is null.
   
    ```
   TimerInstance timerInstance = 
TimerInstance.with(jobDetails.getCorrelationId(), null, limit);
   
           Supplier<Boolean> execute = () -> 
executeInUnitOfWork(application.unitOfWorkManager(), () -> {
               process.send(SignalFactory.of("timerTriggered", timerInstance));
               return true;
           });
   
   ```
   we still can see few 401  job cannot be processed error responses as 
"JobDetails" in "execute" method of EmbeddedJobExecutor has null JobDescription



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to