Module: Upperkut
- Defined in:
- lib/upperkut.rb,
lib/upperkut/cli.rb,
lib/upperkut/util.rb,
lib/upperkut/worker.rb,
lib/upperkut/logging.rb,
lib/upperkut/manager.rb,
lib/upperkut/version.rb,
lib/upperkut/processor.rb,
lib/upperkut/middleware.rb,
lib/upperkut/redis_pool.rb,
lib/upperkut/batch_execution.rb,
lib/upperkut/strategies/base.rb,
lib/upperkut/middlewares/datadog.rb,
lib/upperkut/middlewares/rollbar.rb,
lib/upperkut/middlewares/new_relic.rb,
lib/upperkut/strategies/buffered_queue.rb,
lib/upperkut/strategies/scheduled_queue.rb
Overview
Public: Upperkut is a batch background processing tool for Ruby.
Examples:
1) Create a Worker class and the define how to process the batch;
class MyWorker
include Upperkut::Worker
# This is optional
setup_upperkut do |config|
# Define which redis instance you want to use
config.strategy = Upperkut::Strategy.new(
self,
redis: { url: ENV['ANOTHER_REDIS_URL'] }
)
# Define the amount of items must be accumulated
config.batch_size = 2_000 # The default value is 1_000
# How frequent the Processor should hit redis looking for elegible
# batch. The default value is 5 seconds. You can also set the env
# UPPERKUT_POLLING_INTERVAL.
config.polling_interval = 4
# How long the Processor should wait in seconds to process batch
# even though the amount of items did not reached the batch_size.
config.max_wait = 300
end
def perform(batch_items)
SidekiqJobA.perform_async(batch_items)
SidekiqJobB.perform_async(batch_items)
process_metrics(batch_items)
end
end
2) Start pushings items;
Myworker.push_items(
[{'id' => SecureRandom.uuid, 'name' => 'Robert C Hall', 'action' => 'EMAIL_OPENNED'}]
)
3) Start Upperkut;
$ bundle exec upperkut -worker MyWorker --concurrency 10
4) That’s it :)
Defined Under Namespace
Modules: Logging, Middleware, Middlewares, Strategies, Util, Worker Classes: BatchExecution, CLI, Configuration, Manager, Processor, RedisPool, Shutdown
Constant Summary collapse
- VERSION =
'0.7.2'.freeze