== EasyQ - A nice little message queue


EasyQ is my attempt to make a simple and uncomplicated message queue.
It requires an ActiveRecord compatible database. It isn't very fast,
and it doesn't support transactions and it only string messages.
It's not perfect but it works for me. I didn't need those things
for my purposes, and this was built for my purposes, but you're
welcome to use it any. Are you sold?

Oh ya...I made this on Windows and haven't tried it on *nix.

One more thing...I'm new to ruby, and I don't know anything about
RDoc. Deal.

Thanks to Assaf (reliable-msg) for the idea.

== Installation

gem install easy-q

== Setup

create a database on whatever db server your working with.

create a YAML config file. Call it whatever you want, and place it anywhere one the install machine.

sample config:

---
:database:
:adapter: mysql
:username: root
:host: localhost
:port: 3306
:password: password
:database: easy_q
:service:
:address: 0.0.0.0
:port: 2222
:acl:
- deny
- all
- allow
- localhost
- allow
- 127.0.0.1


== Usage

* Command Line Usage:
# installs the database schema
% easy_q install -c config.yaml

# starts a server
% easy_q start -c config.yaml

# stops a server
% easy_q stop -c config.yaml

# shows a list of queues and current message count for a server
% easy_q stats -c config.yaml

# peek at a few messages from the top or bottom of a queue on the server
% easy_q peek queue_name 10 top -c config.yaml
% easy_q peek queue_name 10 bottom -c config.yaml

* Pushing and Popping messages:

require 'drb'

o = DRbObject.new(nil,"druby://localhost:2222")

# push some messages into the queue
# :queue => 'name_of_queue' (required)
# :ttl => 1000 (seconds to live, not required)
# :body => 'hello!!' (the message body, bust be a String class)

100.times => "test", :body => Time.now.to_s)}

# get messages, returns nil or a hash
m = o.pop('text')
puts m[:body] if !m.nil?