Sha256: d049964f1dee1b3292630b086a41b75976670e2666bed904c464dccd780025c1

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

module CottonTail
  module DSL
    # Queue DSL
    class Queue
      def initialize(name, queue, context)
        @name = name
        @queue = queue
        @context = context
      end

      def handle(pattern, handler = nil, &block)
        bind pattern
        @context.handle(pattern, handler, &block)
      end

      def topic(routing_prefix, &block)
        topic = Topic.new(routing_prefix, self)
        topic.instance_eval(&block)
      end

      def bind(pattern)
        return unless @queue.respond_to?(:bind)

        @queue.bind pattern
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cotton-tail-0.7.0 lib/cotton_tail/dsl/queue.rb
cotton-tail-0.6.1 lib/cotton_tail/dsl/queue.rb
cotton-tail-0.6.0 lib/cotton_tail/dsl/queue.rb