Sha256: 55b34fc0c0d0606208c8c84ff2525401cd303c2e789f0c31da2a5c7fb4a43e1b

Contents?: true

Size: 939 Bytes

Versions: 8

Compression:

Stored size: 939 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.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

8 entries across 8 versions & 1 rubygems

Version Path
hot_bunnies-1.3.5-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.4-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.3-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.2-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.3.1-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.2.2-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.2.1-java spec/integration/publisher_confirmations_spec.rb
hot_bunnies-1.2.0-java spec/integration/publisher_confirmations_spec.rb