Sha256: 4d84ccf0c22cf0707c87ae0424c92193278437a84e34b5fbdae766f55ff504c4

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

module MessageDriver
  module Destination
    class Base
      attr_reader :adapter, :name, :dest_options, :message_props

      def initialize(adapter, name, dest_options, message_props)
        @adapter = adapter
        @name = name
        @dest_options = dest_options
        @message_props = message_props
        after_initialize
      end

      def publish(body, headers={}, properties={})
        @adapter.publish(@name, body, headers, @message_props.merge(properties))
      end

      def pop_message(options={})
        @adapter.pop_message(@name, options)
      end

      def after_initialize
        #does nothing, feel free to override as needed
      end

      def message_count
        raise "#message_count is not supported by #{self.class}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
message-driver-0.1.0 lib/message_driver/destination.rb