Announcement Announcement Module
No announcement yet.
Getting started... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting started...


    I am fairly experienced with spring and want to have a go at Spring Batch. Unfortunately there isnt really any very simple examples on the net to get a new developer started. The example code base unfortunately requires you import about 3 xml config with regards to data access and transaction management.

    If I just want one job initially which picks up a file from somewhere and copies it to a number of places and say perfomrs and XSLT transformation on the data. Why then would I need to setup all the other stuff?

    Has anyone else encountered this prob before? I would be grateful if someone could point me to a very simple example where I could setup such a project just to get a feel how it all hangs together.


  • #2
    One thing to keep in mind when evaluating Spring Batch is that every batch run has meta-data stored about the run. This is information such as when the run was started, how many 'items'(in your case, lines) have been processed, and potentially even restart data. Using your file to file job as an example. You may not be interacting with the database at all with your code, but Spring Batch will periodically store the line number you're currently reading from in the database, so that in case of a failure it can start from where it left off. You can configure it not to, but even then it will still be storing other meta-data about the run. Even if it's not very useful for your file to file job, it's generally useful to have one central place to find out the status of your batch jobs. If you don't need meta-data storage for some reason (i'd really recommend it, but I know there are always corner cases, etc) or restart, you could just as easily wrap an SB reader and writer in a for loop, although you would lose some other benefits such as skip handling, etc.

    Having said that, I do think we need to provide some kind of simple 'hello world' example for people to use. The sample project we have covers all of our major scenarios, and thus requires every possible jar imaginable. I am definitely planning on making something that's a bit more simple. However, even a simple 'hello world' job would still require a data source and transaction manager for the reasons mentioned above.