knthmn
10/16/2021, 10:40 AMJob
in the constructor
class SubService(job: Job, ...) { ... }
and I use Job.invokeOnCompletion()
to clean up any resource in it. I also like this for error propagation (the whole service fails if a subservice fails). If I don't want this behavior, I can just wrap the job with a SupervisorJob
in the class.