Sha256: 8c0228d6eece107c281e59612dc16943c099453151a494139928a3201afea822

Contents?: true

Size: 468 Bytes

Versions: 7

Compression:

Stored size: 468 Bytes

Contents

require_relative '../lib/upperkut/worker'
require_relative '../lib/upperkut/strategies/priority_queue'

class PriorityWorker
  include Upperkut::Worker

  setup_upperkut do |config|
    config.strategy = Upperkut::Strategies::PriorityQueue.new(
      self,
      priority_key: -> { |item| item['tenant_id'] },
      batch_size: 1
    )
  end

  def perform(items)
    items.each do |item|
      puts "event dispatched: #{item.inspect}"
      sleep 1
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
upperkut-1.0.4 examples/priority_worker.rb
upperkut-1.0.2 examples/priority_worker.rb
upperkut-1.0.0.rc examples/priority_worker.rb
upperkut-0.8.1 examples/priority_worker.rb
upperkut-0.8.0 examples/priority_worker.rb
upperkut-0.7.5 examples/priority_worker.rb
upperkut-0.7.4 examples/priority_worker.rb