简体   繁体   中英

Suggestions for distributed task scheduling and Job queue in spring boot

REQUIREMENT :

In my project(runs in distributed environment) we have requirement to for a job to be scheduled at fixed time with initial delay of 1 min and it will retry if the job execution failed and it can do a max retry of 10 times with 2 mins delay between each .

TOOLS WITH WHICH WE CAN ACHIEVE THE SAME:

I can achieve the same needed functionality with spring-retry . But, there are multiple containers available (distributed environment). Tools like Rabbit-MQ , Amazon-sqs , Redis-quartz supports this features. But Im not sure which one is better for springboot.

FACTORS FOR CONSIDERATION :

Below are the stuffs that needs to be considered for choosing right tools :

Distributed environment
Consistency
Fault Tolerance
Ease of configuration
Async processing

QUESTION

Basically Im looking for something similar to Resqueue and sidekiq ruby implementation equivalent in Java(springBoot). Has anyone achieved the same functionality in their application ? If so , what would be the better choice /way provided with the pros and cons . Suggestions are welcome .

You can use Spring's RetryTemplate , which is easy to configure.

You can use a SimpleRetryPolicy with a FixedBackOffPolicy in your case. Max retry attempts can be configured with the backOffPeriod property present in the SimpleRetryPolicy according to your requirements (2 min in your case).

This retry mechanism is easy to plug into Spring Boot projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM