Sha256: c317ec64e0c7b52a387eeebb0741d9e954c1d699446263f5d6746017cf1c1d12

Contents?: true

Size: 940 Bytes

Versions: 7

Compression:

Stored size: 940 Bytes

Contents

# install gem and run with:
# bundle exec sidekiq -C example/sidekiq.yml -r ./example/test_app.rb

require 'ice_cube'
require 'sidekiq'
require 'rekiq'
require 'pry'

# define sidekiq worker as you normally would
class TestWorker1
  include Sidekiq::Worker

  sidekiq_options queue: "rekiq_test_worker",
                  retry: 3,
                  rekiq_cancel_method: :cancel

  def perform(arg1, arg2)
    puts "\nhello from TestWorker1, arg1 is #{arg1}, arg2 is #{arg2} " \
         "scheduled work time was #{scheduled_work_time}\n\n"
  end

  def cancel(arg1)
    puts "\ncancel method invoked with arg #{arg1}\n\n"
  end
end

# create ice cube schedule
schedule = IceCube::Schedule.new(Time.now) do |s|
    s.rrule IceCube::Rule.minutely
  end

# invoke method
TestWorker1.perform_recurringly(
    schedule,
    ['Rekiq', 'ola', '!!!'],
    { 'complex' => { 'hash' => 'woot!' } }
  ) do |config|
    config.rekiq_cancel_args 1
  end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rekiq-1.2.0 example/test_app.rb
rekiq-1.1.0 example/test_app.rb
rekiq-1.0.0 example/test_app.rb
rekiq-0.9.3 example/test_app.rb
rekiq-0.9.2 example/test_app.rb
rekiq-0.9.1 example/test_app.rb
rekiq-0.9.0 example/test_app.rb