Sha256: 6979e5831f4c79e3e44274a03750a2bb3c57fa6fab6aae421a599d3e491b6a13
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 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.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dispatch-rider-0.0.4 | lib/dispatch-rider/queue_services/aws_sqs.rb |
dispatch-rider-0.0.3 | lib/dispatch-rider/queue_services/aws_sqs.rb |