examples/resque/sleep_job.rb in jruby-hornetq-0.4.0 vs examples/resque/sleep_job.rb in jruby-hornetq-0.5.0.alpha
- old
+ new
@@ -5,11 +5,11 @@
#
#
# Create a Resque Job with the ability to report status
#
class SleepJob < Resque::JobWithStatus
-
+
# Set the name of the queue to use for this Job Worker
@queue = "sleep_job"
# Must be an instance method for Resque::JobWithStatus
def perform
@@ -27,17 +27,17 @@
# Submit a new request at the command line
if __FILE__ == $0
# Make sure you have a worker running
# jruby resque_worker.rb
-
+
count = (ARGV[0] || 10).to_i
# running the job
puts "Creating the SleepJob"
job_id = SleepJob.create :length => count
puts "Got back #{job_id}"
-
+
# check the status until its complete
while status = Resque::Status.get(job_id) and !status.completed? && !status.failed?
sleep 1
puts status.inspect
end
\ No newline at end of file