Introducing Spring Batch Admin |
|

Spring Batch Admin provides a web-based user interface that features an admin console for Spring Batch applications and systems. It is a new open-source project from SpringSource. A milestone release 1.0.0.M1 will be available soon with all the features below, and we hope to get to a 1.0.0 final release early in 2010.
Main Use Cases
The easiest way to get a quick overview of Spring Batch Admin is to see some screenshots of the main use cases. The user interface is a web application (built with Spring MVC).
Inspect Jobs

The user can inspect the jobs that are known to the system. Jobs are either launchable or non-launchable (in the screenshot they are all launchable). The distinction is that a launchable job is defined and configured in the application itself, whereas a non-launchable job is detected as state left by the execution of a job in another process. (Spring Batch uses a relational database to track the state of jobs and steps, so historic executions can be queried to show the non-launchable jobs.)
Launch Job

Launchable jobs can be launched from the user interface with job parameters provided as name value pairs, or by an incrementer configured into the application.
Inspect Executions

Once a job is executing, or has executed, this view can be used to see the most recent executions, and a brief summary of their status (STARTED, COMPLETED, FAILED, etc.).

Each individual execution has a more detailed view (shown above), and from there the user can click down to a view of each of the step executions in the job (only one in this case). A common reason for wanting to do this is to see the cause of a failure.

The top of the step execution detail view shows the history of the execution of this step across all job executions. This is useful for getting a statistical feel for performance characteristics. A developer running a job in an integration test environment might use the statistics here to compare different parameterisations of a job, to see what effect is of changing (for instance) the commit interval in an item processing step.

The bottom of the step execution view has the detailed meta-data for the step (status, read count, write count, commit count, etc.) as well as an extract of the stack trace from any exception that caused a failure of the step (as in the example shown above).
Stop an Execution

A job that is executing can be stopped by the user (whether or not it is launchable). The stop signal is sent via the database and once detected by Spring Batch in whatever process is running the job, the job is stopped (status moves from STOPPING to STOPPED) and no further processing takes place.
Where to get it
The best place to start is the SpringSource community download page. There is also a snapshot download attached to this article, or you can get the source code from subversion and compile it yourself. Snapshot builds also go up to S3 to the Maven repository every night:
<repository> <id>spring-snapshots</id> <name>Spring Maven Snapshot Repository</name> <url>http://s3.amazonaws.com/maven.springframework.org/snapshot</url> </repository>
There are two JAR artifacts and a WAR sample (org.springframework.batch:spring-batch-admin-sample:war), all of which are in the Maven repository and in SVN. In the the case of the WAR download link from this article the JAR files are included in WEB-INF/lib.
To deploy the sample application just install the WAR into your favourite servlet container, or import the source code into STS and launch the sample with standard Eclipse WTP features (e.g. drag it onto the server or Run As… and run on the server). It uses an in-memory database out of the box, so you will get a fresh copy on each restart of the application.
Similar Posts
- Uploading Job Configurations to Spring Batch Admin
- Spring Framework Maven Artifacts
- Running a Spring Batch Job in The SpringSource Application Platform
- Maven Artifacts
- Practical Use of Spring Batch and Spring Integration





steve says:
Added on November 10th, 2009 at 8:24 amLink to Spring Batch in first line is broken, should probably be http://static.springsource.org/spring-batch/
Dave Syer (blog author) says:
Added on November 10th, 2009 at 9:30 amFixed the broken link, thanks (it used to work at http://www.springframework.org, so something must have changed).
Jay says:
Added on November 10th, 2009 at 12:46 pmIt looks nice, will give it a shot today. Thanks
Steve Mayzak says:
Added on November 10th, 2009 at 12:48 pmThis looks like the start of something great Dave, Nice Work!
chwlund says:
Added on November 10th, 2009 at 3:24 pmlooks very promising! this kind of admin gui and functionality for batches can be very useful for many enterprises!
dodol says:
Added on November 10th, 2009 at 10:17 pmHi Dave,
This looks very cool. Any plan to integrate this with authentication systems like LDAP?
Dave Syer (blog author) says:
Added on November 11th, 2009 at 2:17 amThere is no security enabled by default, and no plans to do that in 1.0.0 as yet because the target is really developers for this release. But the interface is RESTful so it's easy to add URL-based business-specific security with Spring Security. I'll write some more about customisation and extensibility soon (there's a brief run through on the website now) and probably use security as an example.
Timmy says:
Added on November 11th, 2009 at 9:05 amThis really looks really ugly, please do something about the usability and look and feel of the console!!
aki86 says:
Added on November 12th, 2009 at 5:03 pmIs there a way to point it at an existing job repository and try things out?
Dave Syer (blog author) says:
Added on November 13th, 2009 at 5:49 pmSure. It starts up with an in-memory database by default, but all you need to do is provide a properties file to change the database connection, or you can override the dataSource bean definition. The getting-started page on the web site has some basic instructions.
Michael says:
Added on November 18th, 2009 at 11:09 amThis is a really good thing for all the spring batch users…
Is this working with Spring Batch 2.0.3?
Will there be a way to restart a job at any previous step?
For exemple in our case we have two steps that are executed consecutively:
- 1st step allows to launch an external tool
- 2nd step allows to check the log file generated by this tool
What we would like is to retart a the 1st step instead of the last unsuccesfull one.
Thanks.
Dave Syer (blog author) says:
Added on November 18th, 2009 at 11:18 amIt isn't designed to work with Batch 2.0.x. The introspection pieces (if you don't register or launch any jobs) should work because there are no DB schema changes to 2.1.0.
There is nothing different about the step execution sequences in Admin – just a regular Spring Batch job. Your use case (start at first step) sounds like you don't want a restart, just a normal start. So that works. Or did I miss something?
custom research papers says:
Added on November 27th, 2009 at 4:17 amthanks!
Bill Comer says:
Added on November 27th, 2009 at 6:34 amI was very impressed with this after seeing your talk on this at the Spring User Group meeting in Manchester.
Glad it has now gone public
Jay says:
Added on December 2nd, 2009 at 12:21 pmAre you planning to add scheduling functions to this admin console?
Dave Syer (blog author) says:
Added on December 2nd, 2009 at 12:59 pmScheduling can be done natively in the configuration files with Spring 3.0. So we hadn't planned to add any UI features for scheduling in 1.0; but it is one of the most often requested features, so that might change. There should at least be a way to change a schedule for a job deployed in-process. If most people are not going to launch jobs from the console, and therefore in-process jobs are not very interesting, then we would have to consider scheduling out-of-process launches which is a lot more complicated (and almost certainly out of scope for 1.0). I actually don't really know yet what the main use case is that people are interested in, so get on the forum and tell us about what you want to do.
Nils Magnus says:
Added on December 4th, 2009 at 6:54 amSeems like the link to download the sample war is broken.
Dave Syer (blog author) says:
Added on December 4th, 2009 at 7:22 amThanks. I think an alias was set up and it broke that link. I fixed it (hopefully).
Nanditha says:
Added on January 5th, 2010 at 6:26 amI'm still not able to download the war file … Could one of you send me the link ?
Thanks
Nanditha
Dave Syer (blog author) says:
Added on January 5th, 2010 at 7:29 amTry here: http://www.springsource.com/download/community
tcuser says:
Added on February 2nd, 2010 at 1:22 pmSpring Batch Admin – is it a secured application ?. does it offer role based security ?
Thanks
TCUser
Dave Syer (blog author) says:
Added on February 6th, 2010 at 4:34 amWe haven't secured the application out of the box, but it is designed for extension, and trivial to add Spring Security declarations. The URLs are RESTful, so it is easy to secure by feature or even by job names.
Anders Eriksson says:
Added on February 24th, 2010 at 4:32 amHello!
Will there be a release of the Spring Batch Admin (SBA) built on Spring Batch (SB) 2.1.0? Current version of SBA appear to depend on stuff in SB 2.1.0.M4 that was removed in final release…
Thanks,
Anders
Dave Syer (blog author) says:
Added on February 24th, 2010 at 5:37 amThe trunk has already moved to 2.1.0.RELEASE. You can move to a snapshot if you want to pick up the new stuff, or wait for the next release (we are planning one more milestone with 1.0).
Alain says:
Added on February 15th, 2011 at 9:28 amHello,
I have compiled the sample application with maven. I have deployed the war file on weblogic 10.3.1 but I can't see any menus.
I have got an error 404 and a warning into my weblogic console
WARN – DispatcherServlet.noHandlerFound(947) | No mapping found for HTTP request with URI [/spring-batch/index.jsp] in DispatcherServlet with name 'Batch Servlet'
Can you tell what could be wrong ?
Regards
Alain
Dave Syer (blog author) says:
Added on February 15th, 2011 at 12:32 pmWhere did you get the sample app from (that context path looks odd)? Most up to date is on Github git://github.com/SpringSource/spring-batch-admin.git. Or you can get the 1.2.0 release from the community download site http://www.springsource.com/download/community (or a zip with source code from Github).
ciezala says:
Added on September 8th, 2011 at 10:04 amHi,
I'm using Spring batch console spring-batch-admin-1.2.0 with spring 3.0.5.
I can watch all information about spring batch job.
But when I try to stop a running job. This exception is launched HttpRequestMethodNotSupportException and I get an exception "Request method 'POST' not supported" in my browser.
Do you have any idea how to fix this problem ?
Thanks for your answer
Alain
Dave Syer (blog author) says:
Added on September 8th, 2011 at 10:49 amIs there an error on the server console? Please use JIRA (http://jira.springsource.org/browse/BATCHADM) to report problems.
ciezala says:
Added on September 8th, 2011 at 11:05 amUnfortunately, I don't have any exception on the server console
I just get this message "Request method 'POST' not supported" in my browser.
The exception HttpRequestMethodNotSupportException occur in org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver but I don't have more info.
Should I need a specific config ?
Dave Syer (blog author) says:
Added on September 8th, 2011 at 11:10 amYes, you need a specific configuration, but if you use the web.xml from the sample it will work. You need a org.springframework.web.filter.HiddenHttpMethodFilter to convert the POST into a DELETE for the stop request.
ciezala says:
Added on September 8th, 2011 at 11:50 amThanks, now it work fine
AD says:
Added on November 2nd, 2011 at 10:04 amAny suggestions on how to work around acegi security , i am trying to use curl to trigger the jobs , trying different ways of passing credentials
Dave Syer (blog author) says:
Added on November 2nd, 2011 at 11:39 amIt all depends on how you added the security. Probably it would help to look at the man pages for curl. I find that using "-b /tmp/cookies.txt -c /tmp/cookies.txt" works well because then you can just authenticate once (e.g. using a form) and the cookie remembers you for subsequent requests. Or you could set up basic authentication and add the credentials in a header with "-H Authorization: Basic …".
http://www.deskapahendri.com/2011/02/28/jasa-setting-mikrotik-dan-proxy-super-ngebut-24-jam/ says:
Added on December 10th, 2011 at 4:19 pmJasa Setting Mikrotik Jasa Setting Proxy
sathish says:
Added on January 16th, 2012 at 4:53 amcan u provide the congiguration file?
sha tk says:
Added on October 16th, 2012 at 11:07 pmhi Dave Syer, thanks for the blog. Just wanted to check is there a way to customize the spring batch admin GUI screens/templates similar to overriding the admin batch configuration ?
Regunath B says:
Added on December 17th, 2012 at 6:42 amThe Spring Batch admin library is highly customizable and implementations can be replaced via Spring DI. Moreover, all configurations are in XML or UI templates.
I have successfully embedded Spring Batch Admin classes, UI into an embedded Jetty server for my project. See screen shots here : https://github.com/regunathb/Trooper/wiki/Trooper-Batch-Web-Console
Configurations are here : https://github.com/regunathb/Trooper/tree/master/batch-core/src/main/resources/WEB-INF
Thanks @Dave Syer for this useful feature!