Created
March 14, 2012 22:43
-
-
Save denniskuczynski/2040147 to your computer and use it in GitHub Desktop.
Basic Stalker Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/jobs/stalker_example.rb with Full Rails Environment -- This should be stripped down to the bare essentials needed to run... | |
require File.expand_path("../../../config/environment", __FILE__) | |
module Stalker | |
PROCESSING_DELAY = 5 | |
job "basic_job" do |args| | |
log "Running (basic_job), Args: #{args.inspect}" | |
Stalker.enqueue("second_job", { :id => args["id"] }, { :delay => PROCESSING_DELAY }) | |
log "Enqueued (second-job) with delay of #{PROCESSING_DELAY} seconds" | |
end | |
job "second_job" do |args| | |
log "Running (second_job), Args: #{args.inspect}" | |
log "Test Finished" | |
end | |
error do |exception| | |
log "Exception running job #{exception.inspect}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment