You should be able to glue it together with AppFuse, but do you really want this batch functionality going into your WAR file? You might ask your question on the Spring Batch forum at http://forum.springsource.org/forumdisplay.php?f=41 and see what they recommend.

They may recommend using OSGi bundles so you can share your POJOs (in their own OSGi bundle) between your web functionality and your batch processing. This lets you follow DRY (Don't Repeat Yourself) in duplicating the POJO code. Before I do that, I would probably clone the POJOs in a separate application and get that working with Spring Batch. This is pretty much a standalone application that runs as a separate process with cron waking up every 15 minutes and running it. Once you have proven that it works, then you can refactor your code to use OSGi to eliminate the POJO code duplication. If it is only one or two POJOs, it may not be worth it. You might be able to pull off the same thing with eclipse modules.

It would be interesting to report back to the mailing list with what you eventually end up doing.

Manning has a book in progress (available through MEAP) called /_*OSGi In Action*_/ at http://www.manning.com/hall/. This provides good information on OSGi. Craig Walls (author of _/*S*//*pring In Action*/_) also has a new book out called _/*Modular Java-Creating Flexible Application with OSGi and Spring* /_at http://www.pragprog.com/titles/cwosg/modular-java that also looks good and is one of the next on my reading list. This book is now final and has Spring specific content, so this may be your best resource at this time beyond the Spring Batch documentation and examples.

--- Alan

Magnús Skúlason wrote:
Thanks,

looks interesting, is there any way to glue it together with appfuse? So that I could launch an service manager class from appfuse with the CommandLineJobRunner.main() method? Or will I have to put it into a seperate project?

best regards,
Magnus

On Thu, Jul 23, 2009 at 8:42 PM, Alan Gunderson <gunders...@acm.org <mailto:gunders...@acm.org>> wrote:

    You might want to look at Spring Batch  at
    http://static.springsource.org/spring-batch/

    Spring Batch can share your Spring Framework POJOs of your web
    application but it really makes sense for these to be stand alone
    processes as there is no user interaction.

    --- Alan


    Magnús Skúlason wrote:

        Hi,

        I need to execute some time intensive batch jobs in my
        application, such as periodically loading data from a file
        into a database, happening at regular intervals and taking
        maybe 10-20 minutes. I am thinking about where I should put
        the logic, inside a Spring Manager bean that I access with a
        web service, or if I should just write a simple command line
        program to do this.

        I of course would prefer to have it within my appfuse project
        since then I can use my existing model/dao classes and have
        all my code base in one place. But I am a little afraid that
        there might be some pitfalls in running such a heavy batch job
        within the web container and accessed through a web service,
        for example timeout and performance problems. I would love to
        get some feedback on that. Also am I maybe missing a better
        way, is there for instance some way of calling a method of a
        Spring Manager bean in appfuse directly from the command line?
        It would of course need to be setup in the same way (all
        decencies injected).

        best regards,
        Magnus


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
    <mailto:users-unsubscr...@appfuse.dev.java.net>
    For additional commands, e-mail: users-h...@appfuse.dev.java.net
    <mailto:users-h...@appfuse.dev.java.net>


Reply via email to