famoseagle / carrot

A synchronous amqp client

This URL has Read+Write access

famoseagle (author)
Wed Aug 26 12:06:56 -0700 2009
commit  1c27e07cb618a3d64095226a064670152972c33e
tree    e56f8987f8ca5366366c62d845c42d02609b55c1
parent  6918ef0545b1036318315a566c9064f427b8b1d5
carrot /
README.markdown

Carrot

A synchronous amqp client. Based on Aman's amqp client:

http://github.com/tmm1/amqp/tree/master

Motivation

This client does not use eventmachine so no background thread necessary. As a result, it is much easier to use from script/console and Passenger. It also solves the problem of buffering messages and ack responses. For more details see this thread.

There is currently no way to prevent buffering using eventmachine. Support for prefetch is still unreliable.

Example

require 'carrot'

q = Carrot.queue('name')
10.times do |num|
  q.publish(num.to_s)
end

puts "Queued #{q.message_count} messages"
puts

while msg = q.pop(:ack => true)
  puts "Popping: #{msg}"
  q.ack
end
Carrot.stop

LICENSE

Copyright (c) 2009 Amos Elliston, Geni.com; Published under The MIT License, see License