Announcement Announcement Module
No announcement yet.
Spring Batch Job Control - JMX JConsole Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch Job Control - JMX JConsole

    Hi all, I am relatively new to the batch spring framework and our team is currently working on a POC.

    We are evaluating the Spring Batch Framework under various key criteria features. I am currently wondering if there are any tips/best practices for enabling a Spring Batch simple job to be EXPOSED and monitored by JConsole. I know this can be done via Spring. But any samples on this more Spring Batch related.

    If I embed exporter and mBeanExporter under my settlementJob simple job is this the right approach?

    <bean id="settlementJob" parent="simpleJob">
    <bean id="exporter" class="o.sf.jmx.expoert.MBeanExporter">
    <property name="settlementJob">
    <entry key="cgi:service=settlementService">
    <ref local="service"/>
    <property name="namingStrategy" ref="pocNamingStrategy"/>
    <bean id="mbeanExporter" class="o.sf.jmx.expoert.MBeanExporter">
    <property name="autodetect">
    <property name="namingStrategy" ref="pocNamingStrategy"/>


  • #2
    Have you looked at the adhoc-job-launcher-context.xml? It should provide a good example of how to configure JMX.


    • #3
      I took a look at the adhoc-job-launcher-context.xml and managed to get it up and running. I also successfuly connect via my local JConsole and I'm pretty happy about that - so far I like what I see

      My current concern is how to actually wire it into my current job as it's kicked off by the CommandLineRunner?

      My Batch Job:

      main class: .CommandLineJobRunner

      sample Ad hoc:
      org.springframework.batch.sample.TaskExecutorLaunc her

      Do I have to change my jobs entry point to kick off using the TaskExecutor and update the -context.xml to include a MBeanExporter bean as that seems to be tied into the SimpleExportedJobLauncher which I think should be updated to reflect CommandLinJobRunner?


      • #4
        The idea is that you use TaskExecutorLauncher instead of CommandLineJobRunner. Use the config file for that as a template, and replace the hard-coded job configurations with your versions. And remember it's only a sample.