Skip to content

bmizerany/lizzy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

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

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

About

An DSL for creating AMQP agents; quickly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages