[rabbitmq-discuss] AMQP ruby client

Aman Gupta rabbitmq at tmm1.net
Sat Jul 12 10:45:18 BST 2008


I've been working on a Ruby/EventMachine AMQP client over the past few days
and I have a simple client up and running:

    def receive_data data
      Frame.extract(data).each do |frame|
        # log 'got a frame', frame

        case method = frame.payload
        when Protocol::Connection::Start
          send Protocol::Connection::StartOk.new({:platform =>
'Ruby/EventMachine',
                                                  :product => 'AMQP',
                                                  :information => '
http://github.com/tmm1/amqp',
                                                  :version => '0.0.1'},
                                                 'AMQPLAIN',
                                                 {:LOGIN => 'guest',
                                                  :PASSWORD => 'guest'},
                                                 'en_US')

        when Protocol::Connection::Tune
          send Protocol::Connection::TuneOk.new :channel_max => 0,
                                                :frame_max => 131072,
                                                :heartbeat => 0

          send Protocol::Connection::Open.new :virtual_host => '/',
                                              :capabilities => '',
                                              :insist => false

        when Protocol::Connection::OpenOk
          send Protocol::Channel::Open.new, :channel => 1
        end
      end
    end

Feedback and ideas for a higher-level queue/exchange/binding API are
welcome.

  Aman Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080712/5ef725c3/attachment.htm 


More information about the rabbitmq-discuss mailing list