Spring customization of scheduler

28 views Asked by At

I want to implement some custom logic of processing data. It must satisfy two requirements

  1. When a new record is being added to database, launch async task/job to process it
  2. record processing must not be called more than once in X seconds.

By implementing (2) I want to avoid spam of another service, but also if there is no other unprocessed records, i want an immediate execution (1).

If i use Spring Scheduled, which allows cron triggers or periodic, it does not satisfy (1) requirement. If i just run a new async task for every request then it does not satisfy (2) requirement

Is there any approach / framework to implement such logic.

0

There are 0 answers