Sha256: dbedf03aa5b271fabe8c0d6a40df2f6bdc366af9413dc09b676065f3ff1c724d

Contents?: true

Size: 973 Bytes

Versions: 19

Compression:

Stored size: 973 Bytes

Contents

# This is a rudementary queue service that uses file system instead of
# AWS::SQS or SimpleQueue. It addresses SimpleQueue's inability to be used
# by only one application instance while avoiding the cost of setting up AWS::SQS.
# This is ideal to be used in development mode between multiple applications.
module DispatchRider
  module QueueServices
    require "dispatch-rider/queue_services/file_system/queue"
    class FileSystem < Base
      def assign_storage(attrs)
        begin
          path = attrs.fetch(:path)
          Queue.new(path)
        rescue IndexError
          raise RecordInvalid.new(self, ["Path can not be blank"])
        end
      end

      def insert(item)
        queue.add item
      end

      def raw_head
        queue.pop
      end

      def construct_message_from(item)
        deserialize(item.read)
      end

      def delete(item)
        queue.remove item
      end

      def size
        queue.size
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
dispatch-rider-1.0.3 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-1.0.2 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-1.0.1 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-1.0.0 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.7 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.6 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.5 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.4 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.3 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.2 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.1 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.2.0 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.1.2 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.1.1.1 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.1.0 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.0.7 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.0.5 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.0.4 lib/dispatch-rider/queue_services/file_system.rb
dispatch-rider-0.0.3 lib/dispatch-rider/queue_services/file_system.rb