Sha256: 2e575b5f45101b56f265da5fde267cb1ec51052a004fba273dbf5ec5e78de99d
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
require "integration/test_helper" require "azure/service_bus/topics" require "azure/service_bus/subscriptions" require "azure/service_bus/brokered_message" describe "Unlock 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") do |m| m.to = "yo" m.label = 'my_label' end end it "should be able to unlock 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) retrieved.must_be :kind_of?, Azure::ServiceBus::BrokeredMessage assert retrieved.valid? # Now there shouldn't be an available message in the subscription retrieved2 = Azure::ServiceBus::Subscriptions.peek_lock_message_from_subscription(@subscription) refute retrieved2.valid? retrieved2.error.message.must_equal "No messages available within the specified timeout period." # Unlock the message res = Azure::ServiceBus::Subscriptions.unlock_message_from_subscription(@subscription, retrieved) res.must_equal true # The message should be available once again retrieved = Azure::ServiceBus::Subscriptions.peek_lock_message_from_subscription(@subscription) assert retrieved.valid? retrieved.body.must_equal @message.body retrieved.to.must_equal @message.to end end
Version data entries
2 entries across 2 versions & 1 rubygems