Sha256: 0cefbff372d05ca35e28c55f9bc42c8ebaa7c1cc2dc3ce7aa0a14a05614538b3

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

@bunny
Feature: Publishing a Message within a Transaction
  Background:
    Given the following broker configuration:
    """ruby
    MessageDriver::Broker.define do |b|
      b.destination :my_queue, "my_queue", exclusive: true
    end
    """

  Scenario: The block completes successfully
    When I execute the following code:
    """ruby
    with_message_transaction do
      publish(:my_queue, "Transacted Message 1")
      publish(:my_queue, "Transacted Message 2")
    end
    """

    Then I expect to find 2 messages on :my_queue with:
      | body                 |
      | Transacted Message 1 |
      | Transacted Message 2 |

  Scenario: An error is raised inside the block
    When I execute the following code:
    """ruby
    with_message_transaction do
      publish(:my_queue, "Transacted Message 1")
      raise "an error that causes a rollback"
      publish(:my_queue, "Transacted Message 2")
    end
    """

    Then I expect it to raise "an error that causes a rollback"
    And I expect to find no messages on :my_queue

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
message-driver-0.1.0 features/publishing_with_transactions.feature