Sha256: ca16941b2d7944a3fe3b36f9725d88c7887006516f1c67ad926d7ab68f4e48c7

Contents?: true

Size: 1.41 KB

Versions: 53

Compression:

Stored size: 1.41 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe "Channel-level exception" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec

  default_timeout 2

  amqp_before do
    @connection = AMQP.connect
    @channel    = AMQP::Channel.new(@connection)
  end

  after(:all) do
    AMQP.cleanup_state
    done
  end


  #
  # Examples
  #

  it "can be handled with Channel#on_error" do
    @channel.on_error do |ch, channel_close|
      channel_close.method_id.should == 10
      channel_close.class_id.should == 50
      channel_close.reply_code.should == 406
      channel_close.reply_text.should_not be_nil
      channel_close.reply_text.should_not be_empty

      done
    end

    EventMachine.add_timer(0.4) do
      # these two definitions result in a race condition. For sake of this example,
      # however, it does not matter. Whatever definition succeeds first, 2nd one will
      # cause a channel-level exception (because attributes are not identical)
      #
      # 'a' * 80 makes queue name long enough for complete error message to be longer than 127 charachters.
      # makes it possible to detect signed vs unsigned integer issues in amq-protocol. MK.
      AMQP::Queue.new(@channel, "amqpgem.examples.channel_exception.#{'a' * 80}", :auto_delete => true, :durable => false)

      AMQP::Queue.new(@channel, "amqpgem.examples.channel_exception.#{'a' * 80}", :auto_delete => true, :durable => true)
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
amqp-1.1.2 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.1.1 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.1.0 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.0.3 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.1.0.rc1 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.1.0.pre2 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.1.0.pre1 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.0.2 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.0.1 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.0.0 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.10 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.9 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.8 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.0.0.pre2 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.7 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.6 spec/integration/channel_level_exception_handling_spec.rb
amqp-1.0.0.pre1 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.5 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.4 spec/integration/channel_level_exception_handling_spec.rb
amqp-0.9.3 spec/integration/channel_level_exception_handling_spec.rb