Trigger action asynchronously on BatchJob completion

Is there a way for executing a code asynchronously upon completion of a BatchJob?
The waitForCompletion method seems to be a blocking call.
We have map reduce job that triggers a batch job, we want to report some information after that the batch jobs completion, but we don’t want to block the map actions (if will prevent other map from being dispatched).

You can implement the following in your BatchJob type:


  • This code will be invoked when all the batches that were scheduled have successfully finished processing. Will
  • not be called if the job fails.
  • @param job
  •       Batch job.
  • @param options
  •       Options the job was run with.
  • @return optional info that will be returned in the {@link} field.
    allComplete: optional function(job: JT, options: OT) : string

Thank you @trothwein for the hint.
I was actually a platform defined batch job Import.startImport()
This means I need to provision a new type for doing my operation task. It would have been easier if we have got a (javascript lambda) callback to pass to that batch.

@NabilKoroghli I see. One other possibility is to use workflows and have a step after the step for the batch job.