Search code examples
cronmicroservicescron-taskspring-cloud-dataflowspring-cloud-task

Cron Job Microservices


I am using spring cloud and have various microservices for an online shopping vendor. Everything is working as expected.

But, I got a requirement where I need to run a cron job over customer's records, get the customer's who's statement date matches the current date and calculate the rate of interest to be paid. This needs to be run every day.

I am confused about how to accommodate this cron job with MS architecture. Do I need to have another server having just this cron job?


Solution

  • Depending on the platform (eg: cf, k8s..) that you're orchestrating the batch-jobs in SCDF, you could write a simple Quartz based Boot Application that can interact with SCDF's REST endpoints to schedule the Task definitions defined in SCDF.

    There are several online literatures on Quartz + Boot solution.

    We are also working on a native scheduler integration for Cloud Foundry (via PCF Scheduler). Once it ready, you'd be able to schedule (i.e., cron-expressions) for Tasks from SCDF's Dashboard natively.