Sha256: 50d4e3a6486cce0dd0edcec96e8d89bf55b4383e5e6446aec236d32c91aa910a

Contents?: true

Size: 1.1 KB

Versions: 20

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'
require 'integration/eventmachine/spec_helper'

describe AMQ::Client::EventMachineClient, "Basic.Ack" do
  include EventedSpec::SpecHelper
  default_timeout 4

  context "sending 100 messages" do
    let(:messages) { (0..99).map {|i| "Message #{i}" } }

    it "should receive all the messages" do
      @received_messages = []
      em_amqp_connect do |client|
        channel = AMQ::Client::Channel.new(client, 1)
        channel.open do
          queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
          queue.bind("amq.fanout")

          queue.consume do |amq_method|
            queue.on_delivery do |method, header, payload|
              queue.acknowledge(method.delivery_tag)
              @received_messages << payload
            end

            exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
            messages.each do |message|
              exchange.publish(message)
            end
          end

          done(2.5) {
            @received_messages.size == messages.size
          }
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha20 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha19 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha18 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha17 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha16 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha15 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha14 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha13 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha12 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha11 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha10 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha9 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha8 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha7 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha6 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha5 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha4 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha3 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha2 spec/integration/eventmachine/basic_ack_spec.rb
amq-client-0.7.0.alpha1 spec/integration/eventmachine/basic_ack_spec.rb