Methods

AMQP::BasicClient

Public Instance Methods

process_frame(frame) click to toggle source
# File lib/amqp/client.rb, line 7
def process_frame frame
  if mq = channels[frame.channel]
    mq.process_frame(frame)
    return
  end

  case frame
  when Frame::Method
    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 => VERSION},
                                             'AMQPLAIN',
                                             {:LOGIN => @settings[:user],
                                              :PASSWORD => @settings[:pass]},
                                             '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 => @settings[:vhost],
                                          :capabilities => '',
                                          :insist => @settings[:insist])

    when Protocol::Connection::OpenOk
      succeed(self)

    when Protocol::Connection::Close
      # raise Error, "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]}"
      STDERR.puts "#{method.reply_text} in #{Protocol.classes[method.class_id].methods[method.method_id]}"

    when Protocol::Connection::CloseOk
      @on_disconnect.call if @on_disconnect
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.