Sha256: 71d9d738ab5b291cd1c923bbd16aa9440be7f70e615b9d66b34bd6e1869640a1
Contents?: true
Size: 922 Bytes
Versions: 3
Compression:
Stored size: 922 Bytes
Contents
require 'forwardable' require 'upperkut/strategies/buffered_queue' require 'upperkut/middleware' require 'upperkut' module Upperkut module Worker def self.included(base) base.extend(ClassMethods) end module ClassMethods extend Forwardable def_delegators :setup, :strategy, :server_middlewares, :client_middlewares def_delegators :strategy, :metrics, :clear def push_items(items) client_middlewares.invoke(self, items) do strategy.push_items(items) end end def fetch_items strategy.fetch_items end def setup_upperkut yield(setup) if block_given? end def setup @config ||= begin config = Upperkut::Configuration.default.clone config.strategy ||= Upperkut::Strategies::BufferedQueue.new(self) config end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
upperkut-1.0.4 | lib/upperkut/worker.rb |
upperkut-1.0.2 | lib/upperkut/worker.rb |
upperkut-1.0.0.rc | lib/upperkut/worker.rb |