1

I'm trying to understand why one would use Spring Batch over a scripting language like Ruby for running your batch-like jobs.

I'm working on something that will need to run repeatedly and thought Spring Batch sounds interesting because you could use POJOs. The thing is, I already have a job manager that can run whatever I tell it to and alert me if anything goes wrong. Would Spring Batch still be useful for this situation or no?

Thanks for your input.

1
  • please add some details to your question, right now i see no requirements for batch processing at all, job management is not batch processing and Ruby is no batch processing language either (afaik) Mar 18, 2012 at 10:26

2 Answers 2

3

why one would use Spring Batch over a scripting language like Ruby

Well, if Ruby has infrastructure for running batch jobs, it can compete with Spring Batch. Otherwise you'll have to write a lot from scratch. And the basis is quite big: it's not only periodic processing, but also exception handling, connectors for data providers and data consumers. If you feel you can program everything with Ruby – go ahead. Otherwise read Spring Batch docu and see, how the provided functionality can make your life easier.

because you could use POJOs

Well, you need to be more concrete here. Business-specific objects (which flow through Spring Batch) can in general be not POJOs and Spring Batch does not care about that. But Spring Batch classes are programmed in a way they can be easily integrated into Spring, and thus they have setters/getters for parts that can be tuned.

that can run whatever I tell it to and alert me if anything goes wrong

At least from what you've mentioned you have only the "job management" part, but there is no "batch" part in your story. And that is more tricky: reading data in chunks from source, transforming, and writing it to destination. That includes the proper transaction management and handling of cases when chunk should be redone, or chunk cannot be restarted and one need to redo the whole job, or skipping the chunk.

0

Sidekiq is something in Ruby you can try. It is a simple queue backed task processing mechanism. It is the closest that I have seen that does batch processing as well as retries if something fails. It supports the ability to run multiple workers to process the same queue. The downside is that your workers should be idempotent and there is no notion of a state. I am aware of Batsir that attempts to solve this but I have not tried it myself.

Sidekiq - simple and easier to ramp up Spring Batch - workflow engine and can be fine tuned but slightly harder to ramp up.

Checkout Spring Batch with Batch Admin if you will and that might give you a good overview of Spring Batch. Right now I am trying to get Spring Batch up and running using JRuby so that I can write my workers in Ruby. That is yet another option.

Those are just my two cents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.