How to cancel a work (Schecduled or running )

I have requirement where i need to cancel the my custom Work (sub class of AbstractWork) in The WorkManager i don't find any method for this specific requirement .

What i need to to to implement this feature ? any suggestion will be help full.

My Use case :

We are using two workers in our application as described below

  1. Import a large amount of data in the nuxeo data base (as per our business rules ) .
  2. Export the data in zip format from the database (as per our business rules )

In above both the cases the user see the progress of the work done on the GUI (custom) . Currently There is no way to stop the work .

So now we are adding a cancel button for each work if you want to cancle the import or export before it is completed you can cancel .

I hope i am clear .

Thanks Atul

0 votes

1 answers

2425 views

ANSWER



There is no provision for canceling Work instances today through the WorkManager. What you could do is set a flag somewhere, and when your Work starts executing just check the flag and do nothing if it's present.

Also please could you describe your use case? (Edit the original question.) Understanding the use case would help us decide if this an API that we should add, if it's possible.

0 votes



hello Florent ,

Thanks for the reply and suggestion . I update my question with my use case .

09/11/2014