Sha256: e79fa0aa929e96b480de9afd45b151205fb2cf9bcb8ef18d87aa4a8754c01349

Contents?: true

Size: 942 Bytes

Versions: 9

Compression:

Stored size: 942 Bytes

Contents

require "spec_helper"

describe "Any channel" do

  #
  # Environment
  #

  let(:connection) { HotBunnies.connect }
  let(:channel)    { connection.create_channel }

  after :each do
    channel.close
    connection.close
  end

  let(:latch) { java.util.concurrent.CountDownLatch.new(1) }

  class ConfirmationListener
    include com.rabbitmq.client.ConfirmListener

    def initialize(latch)
      @latch = latch
    end

    def handle_ack(delivery_tag, multiple)
      @latch.count_down
    end

    def handle_nack(delivery_tag, multiple)
      @latch.count_down
    end
  end


  #
  # Examples
  #

  it "can use publisher confirmations with listener objects" do
    channel.confirm_select
    channel.add_confirm_listener(ConfirmationListener.new(latch))

    queue = channel.queue("", :auto_delete => true)
    Thread.new do
      channel.default_exchange.publish("", :routing_key => queue.name)
    end

    latch.await
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hot_bunnies-1.5.0-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.4.0-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.4.0.pre4-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.4.0.pre3-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.4.0.pre2-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.4.0.pre1-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.8-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.7-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.6-java spec/integration/publisher_confirmations_spec.rb