Parent

AMQP::Channel

h2. What are AMQP channels

To quote {bit.ly/hw2ELX AMQP 0.9.1 specification}:

AMQP is a multi-channelled protocol. Channels provide a way to multiplex a heavyweight TCP/IP connection into several light weight connections. This makes the protocol more “firewall friendly” since port usage is predictable. It also means that traffic shaping and other network QoS features can be easily employed. Channels are independent of each other and can perform different functions simultaneously with other channels, the available bandwidth being shared between the concurrent activities.

h2. Opening a channel

*Channels are opened asynchronously*. There are two ways to do it: using a callback or pseudo-synchronous mode.

@example Opening a channel with a callback

  # this assumes EventMachine reactor is running
  AMQP.connect("amqp://guest:guest@dev.rabbitmq.com:5672") do |client|
    AMQP::Channel.new(client) do |channel, open_ok|
      # when this block is executed, channel is open and ready for use
    end
  end