Class: Queuel::SQS::Message

Inherits:
Base::Message show all
Defined in:
lib/queuel/sqs/message.rb

Defined Under Namespace

Classes: BucketDoesNotExistError, InsufficientPermissions, NoBucketNameSupplied

Constant Summary collapse

MAX_KNOWN_BYTE_SIZE =
256

Instance Attribute Summary

Attributes inherited from Base::Message

#body, #id, #queue

Instance Method Summary collapse

Methods inherited from Base::Message

#empty?, #initialize, #present?

Constructor Details

This class inherits a constructor from Queuel::Base::Message

Instance Method Details

#-(write) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/queuel/sqs/message.rb', line 59

def s3_transaction(method, *args)
  bucket_name = options[:s3_bucket_name]
  raise NoBucketNameSupplied if bucket_name.nil?
  my_bucket = s3.buckets[bucket_name]
  if my_bucket.exists?
    begin
      send("s3_#{method}", my_bucket, *args)
    rescue AWS::S3::Errors::AccessDenied => e
      raise InsufficientPermissions, "Unable to read from bucket: #{e.message}"
    end
  else
    raise BucketDoesNotExistError, "Bucket has either expired or does not exist"
  end
end

#deleteObject



11
12
13
# File 'lib/queuel/sqs/message.rb', line 11

def delete
  message_object.delete
end

#raw_bodyObject



7
8
9
# File 'lib/queuel/sqs/message.rb', line 7

def raw_body
  @raw_body ||= message_object ? pull_message : push_message
end