Announcement Announcement Module
Collapse
No announcement yet.
Spring Batch Job Control - JMX JConsole Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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">
    <map>
    <entry key="cgi:service=settlementService">
    <ref local="service"/>
    </entry>
    </map>
    </property>
    <property name="namingStrategy" ref="pocNamingStrategy"/>
    </bean>
    <bean id="mbeanExporter" class="o.sf.jmx.expoert.MBeanExporter">
    <property name="autodetect">
    <value>true</value>
    </property>
    <property name="namingStrategy" ref="pocNamingStrategy"/>
    </bean>

    Thanks!

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

    Comment


    • #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:
      org.springframework.batch.execution.launch.support .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?

      Comment


      • #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.

        Comment

        Working...
        X