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