Nikita
Nikita

Reputation: 1515

Call Spring Component method with delay

I have a list of n UUIDs. Using each UUID I'm retrieving some data and do some logic. The problem is that if I will execute all of them at once it will create high load. So the target is to call Spring Component method for each UUID with fixed delay 1s. For example for the first UUID method will be called after 1 second delay, for the second after 2 second delay etc. And it should be executed only once. How can I do it correctly in Spring framework? I almost sure that Spring should have some mechanism for doing that. And I'm trying to avoid using Thread.sleep or pure Java ways.

Upvotes: 0

Views: 2547

Answers (1)

Mohit Mutha
Mohit Mutha

Reputation: 3001

Will the spring task executor work for you?

Task Execution and Scheduling

Upvotes: 1

Related Questions