Claus Ibsen created CAMEL-24278:
-----------------------------------

             Summary: camel-support - BackgroundTask should keep task 
registered in TaskManagerRegistry during blocking run
                 Key: CAMEL-24278
                 URL: https://issues.apache.org/jira/browse/CAMEL-24278
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: Claus Ibsen


When a BackgroundTask is used via the blocking run() method (e.g. Kafka 
reconnection, PgEvent, SMPP), the task removes itself from the 
TaskManagerRegistry inside runTaskWrapper() as soon as the supplier succeeds or 
the budget exhausts. This happens before run() returns and before 
waitForTaskCompletion() cleans up.

This causes the task to be invisible in the Internal Tasks dev console even 
though the blocking run() call has not returned. For the Kafka reconnection use 
case, this means the TUI Internal Tasks tab cannot show the reconnection task 
reliably.

The fix: when run() is called (blocking path), register the task in the 
registry immediately in run() and skip add/remove in runTaskWrapper(). Let 
waitForTaskCompletion() handle the final cleanup. The schedule() path 
(non-blocking, used by SJMS and Master) is unchanged.



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

Reply via email to