Dec 16th, 2011, 08:25 AM
Multiple JVMs - batch admin and command line?
I'm getting ready to try Spring Batch and Batch Admin on a new project and I want to be sure I've got the model right.
My main question: Can multiple JVMs stay in sync? For example:
I'd like to use Batch Admin for small jobs, reporting, status, etc. The obvious stuff.
But say I have a long running, multi-hour batch. I may want to START the job using Batch Admin, but I'd like to do this as "fire and forget" so that there's nothing in the web app that has to hang around. I'd like to be able to restart the web app, for example, while the long batch is running.
So I'm assuming that the long running batch must be a Batch command line tool, yes?
In the mean time, the long running batch command line works away and eventually finishes. Because it's a Batch tool (and not, for example, a plain system sort or something), the Batch framework in the command line tool updates the state in the Batch database.
Does this work? Is the framework designed to hold together (stay in sync) in this instance?
How do I "fire and forget" in Batch? It not as simple as just "asynchronous" is it? Meaning, I don't want a thread hanging around waiting for the long batch to finish.
Can I do this? Or am I missing it? What's best practice?
Many thanks for pointers.
Nov 1st, 2012, 06:55 AM
Did you find any answer to the question above. I am precisely looking for a solution to the same problem. I have a job that runs for hours and I need to launch it from the spring batch admin deployed in a web container. But I want the job to run in a different JVM instance without distrubing my JBOSS server performance. How do I do that?
Nov 1st, 2012, 08:31 AM
No, sorry, I never got that far with spring batch. And no one stepped up to the question here. Please let me know what you find out!
Nov 2nd, 2012, 03:43 PM
The short answer is that there is nothing within Batch (or Spring for that matter that I'm aware of) that will kick off a new JVM for you to run your app (job in this case). I'd recommend taking a look at the Spring Batch Integration project and the message based launching pieces in there. With those, you could setup a JVM to run admin and others to listen for jobs requests to be run in.