bmizerany / lizzy
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
cbc7adf
bmizerany (author)
Thu Nov 20 18:28:55 -0800 2008
lizzy /
| name | age | message | |
|---|---|---|---|
| |
README.textile | Thu Nov 20 18:28:55 -0800 2008 | |
| |
lib/ | Thu Nov 20 17:01:54 -0800 2008 |
README.textile
Lizzy – The lightweight agent system for AMQP for Ruby
Features
- Automatic logging of publishing, receiving, and errors through AMQP
- Built-in event tracking via logging
- Easy to use DSL for listening and publishing of events
- Tight integration with tmm1-amqp so you may take advantage of advanced AMQP features
- Used in Production at Heroku to manage/scale all your apps!
Setup / Dependencies
You will need RabbitMQ or another AMQP server installed (only tested with RabbitMQ)
http://www.rabbitmq.com/install.html#generic-unix
Gem dependencies
- eventmachine (http://github.com/eventmachine/eventmachine/tree/master)
- tmm1-amqp (http://github.com/tmm1/amqp)
- json (http://json.rubyforge.org/)
Install
gem install lizzy
or
Download source from http://github.com/heroku/lizzy
A quick listener example
# agent.rb
require 'rubygems'
require 'lizzy'
Lizzy.start({}) do # start AMQP with sensible defaults
Lizzy.listen4("mail.sent") do |listener, info, req|
p [Time.now, :request, req]
# We need to save an attachment. This may take awhile; defer from here
listener.defer do
save_attachment(req[:attachment], "baxter.jpg")
o.publish("attachment.saved", { :filename => "baxter.jpg" })
end
end
end
Sending message from a CLI script
# send_message.rb
require "rubygems"
require "lizzy"
Lizzy.start do
Lizzy.publish("mail.sent", { :attachment => 'hello world' })
Lizzy.stop_safe
end
