Socket
Book a DemoInstallSign in
Socket

jruby-quartz

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jruby-quartz

1.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

= jruby-quartz

== Instructions

Requires the following jars in your application container and if running with just jruby place these in your $JRUBY_HOME/lib

commons-collections-3.2.x.jar commons-logging.jar log4j.jar quartz-1.6.x.jar

If you are running a current version of JBoss you already have these! If you are running an alternative container you will need to check it's lib directory for the presence of these jars.

If you need these jars you can find them within the apache commons project and the quartz jar on opensymphony

== Installation

gem install git://github.com/techwhizbang/jruby-quartz.git

== Usage

The best way to leverage jruby-quartz is to simply extend the BaseScheduler and implement any number of jobs you need to run.

For example all you need to do is specify some basic attributes including the cron expression representing the frequency of the job(s) you want to with it:

class IntegrationScheduler < BaseScheduler

def initialize(cron_expression) super @cron_expression = cron_expression @base_jobs_group = "IntegrationJobs" @base_triggers_group = "IntegrationTriggers" end end

Then just extend the base job by putting all of the work you want to perform inside the perform_job method.

class IntegrationJob < Jobs::BaseJob

def perform_job worker_one = mock('worker class one', :whatever => "123") worker_two = mock('worker class two', :whatever => '123') end end

If you are running Rails you can throw the schedule! method into a custom initializer. An example of this would be like so: Notice the Rails.env /container/, I defined custom environments that only run when inside a Java container so that the schedule! method doesn't get fired off during testing.

if RUBY_PLATFORM =~ /java/

LoggerOneScheduler.new("0 0/1 * * * ?").schedule!(Jobs::LoggerOneJob) LoggerTwoScheduler.new("0 0/2 * * * ?").schedule!(Jobs::LoggerTwoJob)

end

If you are planning on using this with a Rails stack, I would recommend using this only with Rails 2.2 or higher because thread safety == 1 runtime

1 runtime means your schedule initializer is only called once.

=== Other

Problems, comments, and suggestions all welcome. techwhizbang@gmail.com or visit my blog http://techwhizbang.com

FAQs

Package last updated on 18 Jan 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.