Sha256: 188f161ac1b47aeeac0f53ba38895d99cbfb0f2dd326e77617399b3c46deef50

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require "integration/test_helper"
require "azure/service_bus/topics"
require "azure/service_bus/subscriptions"
require "azure/service_bus/brokered_message"

describe "Delete a Message from a Subscription" do

  after do
    ServiceBusTopicNameHelper.clean
  end

  before do
    @topic = Azure::ServiceBus::Topics.create(ServiceBusTopicNameHelper.name)
    @subscription = @topic.subscriptions.create("subscription-name")
    @message = Azure::ServiceBus::BrokeredMessage.new("some text", "prop1" => "val1") {|m| m.to = 'me' }
  end

  it "should be able to read-delete a message from a subscription" do
    Azure::ServiceBus::Topics.send_message_to_topic(@topic, @message)

    retrieved = Azure::ServiceBus::Subscriptions.peek_lock_message_from_subscription(@subscription)

    result = Azure::ServiceBus::Subscriptions.delete_message_from_subscription(@subscription, retrieved)
    result.must_equal true

    # It should be deleted
    retrieved2 = Azure::ServiceBus::Subscriptions.peek_lock_message_from_subscription(@subscription, :timeout => 2)
    refute retrieved2.valid?
    retrieved2.error.message.must_equal "No messages available within the specified timeout period."
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/integration/service_bus/subscriptions/delete_message_from_subscription_test.rb
azure-0.1.0 test/integration/service_bus/subscriptions/delete_message_from_subscription_test.rb