Module: WindUp
- Defined in:
- lib/wind_up/routers.rb,
lib/wind_up.rb,
lib/wind_up/version.rb,
lib/wind_up/delegator.rb
Overview
A worker to enable flexible, queue-based background processing
Ever wish you could reuse the same background worker pool for multiple types of work? WindUp’s ‘Delegator` was designed to solve this problem.
‘Delegator#perform_with` will instantiate the class and run its
#perform method with any additional arguments provided
-
Gracefully handles errors/crashes
-
Use just like a WindUp Queue or Celluloid Pool; ‘#sync`, `#async`, and `#future` all work
Usage
Create a new ‘Delegator` queue using the WindUp Queue method. Use `Delegator#perform_with` to perform tasks in the background.
“‘ruby # Create a Delegator queue queue = WindUp::Delegator.queue size: 3
# Create a job class class GreetingJob
def perform(name = "Bob")
"Hello, #{name}!"
end
end
# Send the delayed action to the Delegator queue queue.async.perform_with GreetingJob, “Mary” # => nil, work completed in background queue.future.perform_with GreetingJob, “Tim” # => Celluloid::Future, with value “Hello, Tim!”
# Store your queue for future usage Celluloid::Actor = queue “‘
Defined Under Namespace
Modules: Router, Routers Classes: Delegator, InvalidDelegatee
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.queue(opts = {}) ⇒ Object
5 6 7 |
# File 'lib/wind_up.rb', line 5 def self.queue(opts = {}) Delegator.queue opts end |