Sha256: ec1f4a7668eadfb005a5240d81738d33e51822119d0e302484b4f1349dc94f9c

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

@bunny
@in_memory
Feature: Middleware Parameters

  You can provide parameters to your middleware by passing them as additional
  paremeters to the append and prepend calls.

  Background:
    Given I am connected to the broker
    And I have a destination :middleware_queue with no messages on it
    And I have a middleware class
    """ruby
    class ParameterizedMiddleware < MessageDriver::Middleware::Base

      attr_reader :prefix, :seperator

      def initialize(destination, prefix, seperator)
        super(destination)
        @prefix = prefix
        @seperator = seperator
      end

      def on_publish(body, headers, properties)
        ["#{prefix}#{seperator}#{body}", headers, properties]
      end
    end
    """

  Scenario: Adding a parameterized middleware to the stack
    When I execute the following code
    """ruby
    destination = MessageDriver::Client.find_destination(:middleware_queue)
    destination.middleware.append ParameterizedMiddleware, 'pub_pre', ':'
    """
    And I send the following messages to :middleware_queue
      | body           |
      | Test Message 1 |
      | Test Message 2 |

    Then I expect to find the following 2 messages on :middleware_queue
      | raw_body               |
      | pub_pre:Test Message 1 |
      | pub_pre:Test Message 2 |

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
message-driver-1.0.1 features/middleware/middleware_parameters.feature
message-driver-1.0.0 features/middleware/middleware_parameters.feature
message-driver-0.7.2 features/middleware/middleware_parameters.feature
message-driver-0.7.1 features/middleware/middleware_parameters.feature
message-driver-0.7.0 features/middleware/middleware_parameters.feature
message-driver-0.6.1 features/middleware/middleware_parameters.feature
message-driver-0.6.0 features/middleware/middleware_parameters.feature
message-driver-0.5.3 features/middleware/middleware_parameters.feature
message-driver-0.5.2 features/middleware/middleware_parameters.feature
message-driver-0.5.1 features/middleware/middleware_parameters.feature
message-driver-0.5.0 features/middleware/middleware_parameters.feature