Results 1 to 4 of 4

Thread: Spring Batch Job Control - JMX JConsole

  1. #1
    Join Date
    Apr 2008
    Posts
    3

    Default 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. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

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

  3. #3
    Join Date
    Apr 2008
    Posts
    3

    Thumbs up

    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?

  4. #4
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •