TomEE quartz configuration for scheduled methods


TomEE is using quartz to implement @Schedule methods. At the beginning quartz was hidden and its configuration was not exposed.

Since some days it is no more the case!

Now you can specify in several configuration files all quartz properties you want.

Here are the files (to put in META-INF or WEB-INF for webapps):

  • application.properties
  • module.properties
  • openejb-jar.xml in bean properties

The available configuration is well explained on quartz website and can even let you configure quartz in cluster: http://quartz-scheduler.org/documentation/quartz-2.x/configuration/

The nice stuff is now the schedulers can be specific by bean and the schedulers can be monitored/updated through JMX (deactivable if necessary).

Here a little sample of configuration:

org.quartz.scheduler.instanceName = my-app
org.quartz.scheduler.instanceId = my-bean

org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.class = org.superbiz.MyCustomThreadPool

org.quartz.plugin.LogPlugin.class = org.superbiz.MyLogPlugin
org.quartz.plugin.LogPlugin.active = true

Another more real example can be found here: http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering

A big thanks to Enrico Olivelli who helped/helps a lot on this topic.

Want more content ? Keep up-to-date on my new blog

Or stay in touch on twitter @rmannibucau

Advertisement

4 thoughts on “TomEE quartz configuration for scheduled methods

  1. Mika Majakorpi

    For those like me who landed here looking for a way to increase the default EJB timer pool size, the correct property name for TomEE 1.6.0 / OpenEJB 4.6.0 is EjbTimerPool.CorePoolSize instead of openejb.timer.pool.size. The property should be specified in tomee/conf/system.properties.

    Thank you Romain for your help on the mailing list 🙂

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s