Class: Aws::SQS::Message
- Inherits:
-
Object
- Object
- Aws::SQS::Message
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-sqs/message.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#attributes ⇒ Hash<String,String>
‘SenderId`, `SentTimestamp`, `ApproximateReceiveCount`, and/or `ApproximateFirstReceiveTimestamp`.
-
#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`, and `Value`.
-
#message_id ⇒ String
A unique identifier for the message.
- #queue_url ⇒ String
- #receipt_handle ⇒ String
Actions collapse
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #queue ⇒ Queue
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.
- #load ⇒ Object (also: #reload) private
Constructor Details
#initialize(queue_url, receipt_handle, options = {}) ⇒ Message #initialize(options = {}) ⇒ Message
Returns a new instance of Message.
21 22 23 24 25 26 27 |
# File 'lib/aws-sdk-sqs/message.rb', line 21 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() end |
Instance Method Details
#attributes ⇒ Hash<String,String>
‘SenderId`, `SentTimestamp`, `ApproximateReceiveCount`, and/or `ApproximateFirstReceiveTimestamp`. `SentTimestamp` and `ApproximateFirstReceiveTimestamp` are each returned as an integer representing the [epoch time] in milliseconds.
69 70 71 |
# File 'lib/aws-sdk-sqs/message.rb', line 69 def attributes data[:attributes] end |
#body ⇒ String
The message’s contents (not URL-encoded).
56 57 58 |
# File 'lib/aws-sdk-sqs/message.rb', line 56 def body data[:body] end |
#change_visibility(options = {}) ⇒ EmptyStructure
140 141 142 143 144 145 146 147 |
# File 'lib/aws-sdk-sqs/message.rb', line 140 def change_visibility( = {}) = .merge( queue_url: @queue_url, receipt_handle: @receipt_handle ) resp = @client.() resp.data end |
#data ⇒ Types::Message
Returns the data for this Aws::SQS::Message.
116 117 118 119 |
# File 'lib/aws-sdk-sqs/message.rb', line 116 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
124 125 126 |
# File 'lib/aws-sdk-sqs/message.rb', line 124 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
154 155 156 157 158 159 160 161 |
# File 'lib/aws-sdk-sqs/message.rb', line 154 def delete( = {}) = .merge( queue_url: @queue_url, receipt_handle: @receipt_handle ) resp = @client.() resp.data end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
175 176 177 178 179 180 |
# File 'lib/aws-sdk-sqs/message.rb', line 175 def identifiers { queue_url: @queue_url, receipt_handle: @receipt_handle } end |
#load ⇒ Object Also known as: reload
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
107 108 109 110 |
# File 'lib/aws-sdk-sqs/message.rb', line 107 def load msg = "#load is not implemented, data only available via enumeration" raise NotImplementedError, msg end |
#md5_of_body ⇒ String
An MD5 digest of the non-URL-encoded message body string.
50 51 52 |
# File 'lib/aws-sdk-sqs/message.rb', line 50 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].
82 83 84 |
# File 'lib/aws-sdk-sqs/message.rb', line 82 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 [Message Attribute Items and Validation] in the *Amazon Simple Queue Service Developer Guide*.
94 95 96 |
# File 'lib/aws-sdk-sqs/message.rb', line 94 def data[:message_attributes] end |
#message_id ⇒ String
A unique identifier for the message. A ‘MessageId`is considered unique across all AWS accounts for an extended period of time.
44 45 46 |
# File 'lib/aws-sdk-sqs/message.rb', line 44 def data[:message_id] end |
#queue ⇒ Queue
166 167 168 169 170 171 |
# File 'lib/aws-sdk-sqs/message.rb', line 166 def queue Queue.new( url: @queue_url, client: @client ) end |
#queue_url ⇒ String
32 33 34 |
# File 'lib/aws-sdk-sqs/message.rb', line 32 def queue_url @queue_url end |
#receipt_handle ⇒ String
37 38 39 |
# File 'lib/aws-sdk-sqs/message.rb', line 37 def receipt_handle @receipt_handle end |