Skip to content

job monitoring

Mahmoud Ben Hassine edited this page Jun 4, 2017 · 5 revisions

Enable JMX monitoring

Easy Batch allows you to monitor job execution and progress at runtime using JMX. The JMX MBean named org.easybatch.core.monitor:name=YourJobName exposes the following attributes:

  • The job start and end times
  • The job status
  • The number of read records
  • The number of written records
  • The number of filtered records
  • The number of errors

In order to register this JMX MBean, you should enable JMX monitoring at application startup:

Job job = new JobBuilder()
    .enableJmx(true)
    .build();

You can then use any standard JMX compliant tool such as VisualVM to visualize monitoring attributes. The screenshot below shows an example of job monitoring using https://visualvm.github.io/[VisualVM]:

[.text-center] image::jmx.png[width="80%", height="80%"]

JMX monitoring is disabled by default.

Listen to JMX notifications

When you enable JMX monitoring, the job monitor will automatically send notifications about execution progress. In order to listen to these notifications, you need to:

  • Specify the JMX port on which the job monitor should send notifications. This can be done using the com.sun.management.jmxremote.port JVM parameter
  • Use a JobMonitorProxy with a JobMonitoringListener to handle notifications

Easy Batch provides a simple command line listener called CliJobMonitoringListener in the easybatch-tools module. This listener will print execution progress to the standard output.

Clone this wiki locally