2

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 .

shashantrika
  • 1,039
  • 1
  • 9
  • 29

2 Answers2

0

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.

Paul Benn
  • 1,911
  • 11
  • 26
  • 3
    Spring retry satisfies the above condition , but it fails miserably when it comes to distributed environment . So, Im looking out for some tools in achieving the same in distributed environment. – shashantrika Apr 28 '19 at 15:51
0

Alternatives for distributed tasks include

  • Raft libs for JVM
  • Hazelcast used in CP mode (which uses Raft)
  • k8s (which uses etcd)
  • spring cloud consul
  • dbscheduler
  • akka has a singleton
NicuMarasoiu
  • 776
  • 9
  • 25