Thursday, 2 December 2021

How to pass data from failed child worker to last worker in chain with android CoroutineWorkers

My current android application employs chained workers to perform complex background tasks.

Im observing only the last worker in the chain to detect whether or not the complete chain has completed successfully. This approach has been acceptable till now, as I have a new requirement where I need to also pass data when a worker fails.

is my only option to start observing all workers in the chain?

or

is it possible to set output data in a failing child worker and access it from the workinfo obtained from observing the last worker in the chain?

for example if i have a chain of 5 sequential workers as follows:-

WorkerA
WorkerB
WorkerC
WorkerD
WorkerZ

I am only observing WorkerZ, and WorkerC fails and sets outputData in its result, is there any way I can access that WorkData from observing only WorkerZ?



from How to pass data from failed child worker to last worker in chain with android CoroutineWorkers

No comments:

Post a Comment