Class: Aws::SQS::Message
- Inherits:
-
Object
- Object
- Aws::SQS::Message
- Defined in:
- gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#attributes ⇒ Hash<String,String>
A map of the attributes requested in
ReceiveMessage
to their respective values. -
#body ⇒ String
The message's contents (not URL-encoded).
-
#md5_of_body ⇒ String
An MD5 digest of the non-URL-encoded message body string.
-
#md5_of_message_attributes ⇒ String
An MD5 digest of the non-URL-encoded message attribute string.
-
#message_attributes ⇒ Hash<String,Types::MessageAttributeValue>
Each message attribute consists of a
Name
,Type
, andValue
. -
#message_id ⇒ String
A unique identifier for the message.
-
#queue_url ⇒ String
-
#receipt_handle ⇒ String
Actions collapse
Associations collapse
Instance Method Summary collapse
-
#client ⇒ Client
-
#data ⇒ Types::Message
Returns the data for this Message.
-
#data_loaded? ⇒ Boolean
Returns
true
if this resource is loaded. -
#initialize(*args) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(queue_url, receipt_handle, options = {}) ⇒ Message #initialize(options = {}) ⇒ Message
Returns a new instance of Message.
24 25 26 27 28 29 30 31 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 24 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @queue_url = extract_queue_url(args, ) @receipt_handle = extract_receipt_handle(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#attributes ⇒ Hash<String,String>
A map of the attributes requested in ReceiveMessage
to their
respective values. Supported attributes:
ApproximateReceiveCount
ApproximateFirstReceiveTimestamp
MessageDeduplicationId
MessageGroupId
SenderId
SentTimestamp
SequenceNumber
ApproximateFirstReceiveTimestamp
and SentTimestamp
are each
returned as an integer representing the epoch time in
milliseconds.
90 91 92 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 90 def attributes data[:attributes] end |
#body ⇒ String
The message's contents (not URL-encoded).
61 62 63 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 61 def body data[:body] end |
#change_visibility(options = {}) ⇒ EmptyStructure
161 162 163 164 165 166 167 168 169 170 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 161 def change_visibility( = {}) = .merge( queue_url: @queue_url, receipt_handle: @receipt_handle ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#client ⇒ Client
122 123 124 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 122 def client @client end |
#data ⇒ Types::Message
Returns the data for this Aws::SQS::Message.
137 138 139 140 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 137 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
Returns true
if this resource is loaded. Accessing attributes or
#data on an unloaded resource will trigger a call to #load.
145 146 147 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 145 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
177 178 179 180 181 182 183 184 185 186 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 177 def delete( = {}) = .merge( queue_url: @queue_url, receipt_handle: @receipt_handle ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#md5_of_body ⇒ String
An MD5 digest of the non-URL-encoded message body string.
55 56 57 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 55 def md5_of_body data[:md5_of_body] end |
#md5_of_message_attributes ⇒ String
An MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5 digest. For information about MD5, see RFC1321.
103 104 105 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 103 def data[:md5_of_message_attributes] end |
#message_attributes ⇒ Hash<String,Types::MessageAttributeValue>
Each message attribute consists of a Name
, Type
, and Value
. For
more information, see Amazon SQS message attributes in the
Amazon SQS Developer Guide.
115 116 117 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 115 def data[:message_attributes] end |
#message_id ⇒ String
A unique identifier for the message. A MessageId
is considered unique
across all Amazon Web Services accounts for an extended period of
time.
49 50 51 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 49 def data[:message_id] end |
#queue ⇒ Queue
191 192 193 194 195 196 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 191 def queue Queue.new( url: @queue_url, client: @client ) end |
#queue_url ⇒ String
36 37 38 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 36 def queue_url @queue_url end |
#receipt_handle ⇒ String
41 42 43 |
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 41 def receipt_handle @receipt_handle end |