Wide Receiver
Wide Receiver is a work queue system in which the worker classes decide which messages to process.
Installation
Add this line to your application's Gemfile:
gem 'wide_receiver'
And then execute:
$ bundle
Or install it yourself as:
$ gem install wide_receiver
Usage
Configure Wide Receiver to connect to your queuing system (currently only supports Redis pubsub):
WideReceiver::Config.instance.queue_url = 'redis://localhost/6379/5'
Create a worker class that extends WideReceiver::Worker
and specifies which channel
patterns it wants to process:
class Rice
extend WideReceiver::Worker
listen 'montana.pass.*'
def perform(channel, )
# do something with message
end
end
Start the master process:
WideReceiver::Master.new.start
This will start one thread per unique channel pattern. When a message is received on a matching channel, each worker class that expressed interest in that pattern will be instantiated, and the instance will receive the message.
TODO
- add support for RabbitMQ
- add proper command line runner
Contributing
- Fork it ( http://github.com/rubysolo/wide_receiver/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request