spring-projects / spring-batch

Spring Batch is a framework for writing batch applications using Java and Spring
http://projects.spring.io/spring-batch/
Apache License 2.0
2.73k stars 2.35k forks source link

Now throttlerLimit() is deprecated everywhere, providing a ThrottlerRepeatOperations could be convenient #4531

Open nightswimmings opened 10 months ago

nightswimmings commented 10 months ago

As per the note "@deprecated with no replacement since 5.0, scheduled for removal in 6.0. Use a custom {@link RepeatOperations} implementation (based on a {@link TaskExecutor} with a bounded task queue) and set it on the step with {@link #stepOperations(RepeatOperations)}.", I think it would be convenient to have some built-in replacement.

IMO this is pertinent because:

My 2 cents, but thanks either way!

Mom0aut commented 6 months ago

Could someone provide an real example of how i can set the "old" throttleLimit with the "new" RepeatOperations.

Thanks!

rmaheshk commented 5 months ago

The document is unclear on how to use custom RepeatOperation to replace the deprecation of throttleLimit however, I have implemented as follows after going through few documentation but still no use

@Bean public RepeatOperations createRepeatOperations() { TaskExecutorRepeatTemplate repeatOperations = new TaskExecutorRepeatTemplate(); repeatOperations.setTaskExecutor(taskExecutor()); return repeatOperations; }

and use the createRepeatOperations() through AbstractTaskletStepBuilder.stepOperation()

NaitYoussef commented 4 months ago

The solution you provided @rmaheshk won't work since you're using TaskExecutorRepeatTemplate which it self uses the deprecated method. You should implement your own custom RepeatOperations for it to work. Check this post it says the same thing https://github.com/spring-projects/spring-batch/issues/4389#issuecomment-1697409295

advaidg commented 1 month ago

@NaitYoussef Any samples? @rmaheshk - If you were able to fix this please share the details

RT-1904129 commented 1 month ago

Hi @NaitYoussef ,@rmaheshk Can you give me some Tips or examples on how to implement this ???