RedisMQ
An implementation of topic exchanges using Redis.
Installation
Add this line to your application's Gemfile:
gem 'redismq'
And then execute:
$ bundle
Or install it yourself as:
$ gem install redismq
Usage
As a publisher
require 'redismq'
client = RedisMQ::Client.new
# pretend a customer signed up, publish his info to the 'customer.signup' topic
client.publish('customer.signup', { id: 1 })
As a consumer
require 'redismq'
client = RedisMQ::Client.new
# ensure that all items sent to customer.signup wind up in the email queue
client.bind('customer.signup', 'email')
# assume that a message has been sent...
client.pop('email')
# {"header"=>{"topic"=>"customer.signup"}, "payload"=>{:id=>1}}
# or, block and wait for something to hit the queue
client.bpop('email')
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request