Sha256: 8f0096a81f5d6eccdbdc0b0b298b597fd7032c6504436423dfaac0c80e017ca5
Contents?: true
Size: 978 Bytes
Versions: 7
Compression:
Stored size: 978 Bytes
Contents
# This queue service is based on aws sqs. # To make this queue service work, one would need the aws sqs gem to be installed. module DispatchRider module QueueServices class AwsSqs < Base require "dispatch-rider/queue_services/aws_sqs/message_body_extractor" def assign_storage(attrs) begin AWS::SQS.new(:logger => nil).queues.named(attrs.fetch(:name)) rescue NameError raise AdapterNotFoundError.new(self.class.name, 'aws-sdk') rescue IndexError raise RecordInvalid.new(self, ["Name can not be blank"]) end end def insert(item) queue.send_message(item) end def raw_head queue.receive_message end def construct_message_from(item) deserialize(MessageBodyExtractor.new(item).extract) end def delete(item) item.delete end def size queue.approximate_number_of_messages end end end end
Version data entries
7 entries across 7 versions & 1 rubygems