Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An DSL for creating AMQP agents; quickly.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 README.textile
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

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
Something went wrong with that request. Please try again.