| 1 | |||
| 2 | package Paws::SQS::ReceiveMessage; | ||
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | has AttributeNames => (is => 'ro', isa => 'ArrayRef[Str|Undef]'); | |
| 5 | 1 | has MaxNumberOfMessages => (is => 'ro', isa => 'Int'); | |
| 6 | 1 | has MessageAttributeNames => (is => 'ro', isa => 'ArrayRef[Str|Undef]'); | |
| 7 | 1 | has QueueUrl => (is => 'ro', isa => 'Str', required => 1); | |
| 8 | 1 | has ReceiveRequestAttemptId => (is => 'ro', isa => 'Str'); | |
| 9 | 1 | has VisibilityTimeout => (is => 'ro', isa => 'Int'); | |
| 10 | 1 | has WaitTimeSeconds => (is => 'ro', isa => 'Int'); | |
| 11 | |||
| 12 | 1 | ▶ | use MooseX::ClassAttribute; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 1 | class_has _api_call => (isa => 'Str', is => 'ro', default => 'ReceiveMessage'); | |
| 15 | 1 | class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::SQS::ReceiveMessageResult'); | |
| 16 | 1 | class_has _result_key => (isa => 'Str', is => 'ro', default => 'ReceiveMessageResult'); | |
| 17 | 1 | 1; | |
| 18 | |||
| 19 | ### main pod documentation begin ### | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | Paws::SQS::ReceiveMessage - Arguments for method ReceiveMessage on L<Paws::SQS> | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | This class represents the parameters used for calling the method ReceiveMessage on the | ||
| 28 | L<Amazon Simple Queue Service|Paws::SQS> service. Use the attributes of this class | ||
| 29 | as arguments to method ReceiveMessage. | ||
| 30 | |||
| 31 | You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to ReceiveMessage. | ||
| 32 | |||
| 33 | =head1 SYNOPSIS | ||
| 34 | |||
| 35 | my $sqs = Paws->service('SQS'); | ||
| 36 | my $ReceiveMessageResult = $sqs->ReceiveMessage( | ||
| 37 | QueueUrl => 'MyString', | ||
| 38 | AttributeNames => [ | ||
| 39 | 'SenderId', | ||
| 40 | ... # values: SenderId, SentTimestamp, ApproximateReceiveCount, ApproximateFirstReceiveTimestamp | ||
| 41 | ], # OPTIONAL | ||
| 42 | MaxNumberOfMessages => 1, # OPTIONAL | ||
| 43 | MessageAttributeNames => [ 'MyMessageAttributeName', ... ], # OPTIONAL | ||
| 44 | ReceiveRequestAttemptId => 'MyString', # OPTIONAL | ||
| 45 | VisibilityTimeout => 1, # OPTIONAL | ||
| 46 | WaitTimeSeconds => 1, # OPTIONAL | ||
| 47 | ); | ||
| 48 | |||
| 49 | # Results: | ||
| 50 | my $Messages = $ReceiveMessageResult->Messages; | ||
| 51 | |||
| 52 | # Returns a L<Paws::SQS::ReceiveMessageResult> object. | ||
| 53 | |||
| 54 | Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. | ||
| 55 | For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/sqs/ReceiveMessage> | ||
| 56 | |||
| 57 | =head1 ATTRIBUTES | ||
| 58 | |||
| 59 | |||
| 60 | =head2 AttributeNames => ArrayRef[Str|Undef] | ||
| 61 | |||
| 62 | A list of attributes that need to be returned along with each message. | ||
| 63 | These attributes include: | ||
| 64 | |||
| 65 | =over | ||
| 66 | |||
| 67 | =item * | ||
| 68 | |||
| 69 | C<All> E<ndash> Returns all values. | ||
| 70 | |||
| 71 | =item * | ||
| 72 | |||
| 73 | C<ApproximateFirstReceiveTimestamp> E<ndash> Returns the time the | ||
| 74 | message was first received from the queue (epoch time | ||
| 75 | (http://en.wikipedia.org/wiki/Unix_time) in milliseconds). | ||
| 76 | |||
| 77 | =item * | ||
| 78 | |||
| 79 | C<ApproximateReceiveCount> E<ndash> Returns the number of times a | ||
| 80 | message has been received across all queues but not deleted. | ||
| 81 | |||
| 82 | =item * | ||
| 83 | |||
| 84 | C<AWSTraceHeader> E<ndash> Returns the X-Ray trace header string. | ||
| 85 | |||
| 86 | =item * | ||
| 87 | |||
| 88 | C<SenderId> | ||
| 89 | |||
| 90 | =over | ||
| 91 | |||
| 92 | =item * | ||
| 93 | |||
| 94 | For an IAM user, returns the IAM user ID, for example | ||
| 95 | C<ABCDEFGHI1JKLMNOPQ23R>. | ||
| 96 | |||
| 97 | =item * | ||
| 98 | |||
| 99 | For an IAM role, returns the IAM role ID, for example | ||
| 100 | C<ABCDE1F2GH3I4JK5LMNOP:i-a123b456>. | ||
| 101 | |||
| 102 | =back | ||
| 103 | |||
| 104 | =item * | ||
| 105 | |||
| 106 | C<SentTimestamp> E<ndash> Returns the time the message was sent to the | ||
| 107 | queue (epoch time (http://en.wikipedia.org/wiki/Unix_time) in | ||
| 108 | milliseconds). | ||
| 109 | |||
| 110 | =item * | ||
| 111 | |||
| 112 | C<MessageDeduplicationId> E<ndash> Returns the value provided by the | ||
| 113 | producer that calls the C< SendMessage > action. | ||
| 114 | |||
| 115 | =item * | ||
| 116 | |||
| 117 | C<MessageGroupId> E<ndash> Returns the value provided by the producer | ||
| 118 | that calls the C< SendMessage > action. Messages with the same | ||
| 119 | C<MessageGroupId> are returned in sequence. | ||
| 120 | |||
| 121 | =item * | ||
| 122 | |||
| 123 | C<SequenceNumber> E<ndash> Returns the value provided by Amazon SQS. | ||
| 124 | |||
| 125 | =back | ||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | =head2 MaxNumberOfMessages => Int | ||
| 131 | |||
| 132 | The maximum number of messages to return. Amazon SQS never returns more | ||
| 133 | messages than this value (however, fewer messages might be returned). | ||
| 134 | Valid values: 1 to 10. Default: 1. | ||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | =head2 MessageAttributeNames => ArrayRef[Str|Undef] | ||
| 139 | |||
| 140 | The name of the message attribute, where I<N> is the index. | ||
| 141 | |||
| 142 | =over | ||
| 143 | |||
| 144 | =item * | ||
| 145 | |||
| 146 | The name can contain alphanumeric characters and the underscore (C<_>), | ||
| 147 | hyphen (C<->), and period (C<.>). | ||
| 148 | |||
| 149 | =item * | ||
| 150 | |||
| 151 | The name is case-sensitive and must be unique among all attribute names | ||
| 152 | for the message. | ||
| 153 | |||
| 154 | =item * | ||
| 155 | |||
| 156 | The name must not start with AWS-reserved prefixes such as C<AWS.> or | ||
| 157 | C<Amazon.> (or any casing variants). | ||
| 158 | |||
| 159 | =item * | ||
| 160 | |||
| 161 | The name must not start or end with a period (C<.>), and it should not | ||
| 162 | have periods in succession (C<..>). | ||
| 163 | |||
| 164 | =item * | ||
| 165 | |||
| 166 | The name can be up to 256 characters long. | ||
| 167 | |||
| 168 | =back | ||
| 169 | |||
| 170 | When using C<ReceiveMessage>, you can send a list of attribute names to | ||
| 171 | receive, or you can return all of the attributes by specifying C<All> | ||
| 172 | or C<.*> in your request. You can also use all message attributes | ||
| 173 | starting with a prefix, for example C<bar.*>. | ||
| 174 | |||
| 175 | |||
| 176 | |||
| 177 | =head2 B<REQUIRED> QueueUrl => Str | ||
| 178 | |||
| 179 | The URL of the Amazon SQS queue from which messages are received. | ||
| 180 | |||
| 181 | Queue URLs and names are case-sensitive. | ||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | =head2 ReceiveRequestAttemptId => Str | ||
| 186 | |||
| 187 | This parameter applies only to FIFO (first-in-first-out) queues. | ||
| 188 | |||
| 189 | The token used for deduplication of C<ReceiveMessage> calls. If a | ||
| 190 | networking issue occurs after a C<ReceiveMessage> action, and instead | ||
| 191 | of a response you receive a generic error, it is possible to retry the | ||
| 192 | same action with an identical C<ReceiveRequestAttemptId> to retrieve | ||
| 193 | the same set of messages, even if their visibility timeout has not yet | ||
| 194 | expired. | ||
| 195 | |||
| 196 | =over | ||
| 197 | |||
| 198 | =item * | ||
| 199 | |||
| 200 | You can use C<ReceiveRequestAttemptId> only for 5 minutes after a | ||
| 201 | C<ReceiveMessage> action. | ||
| 202 | |||
| 203 | =item * | ||
| 204 | |||
| 205 | When you set C<FifoQueue>, a caller of the C<ReceiveMessage> action can | ||
| 206 | provide a C<ReceiveRequestAttemptId> explicitly. | ||
| 207 | |||
| 208 | =item * | ||
| 209 | |||
| 210 | If a caller of the C<ReceiveMessage> action doesn't provide a | ||
| 211 | C<ReceiveRequestAttemptId>, Amazon SQS generates a | ||
| 212 | C<ReceiveRequestAttemptId>. | ||
| 213 | |||
| 214 | =item * | ||
| 215 | |||
| 216 | It is possible to retry the C<ReceiveMessage> action with the same | ||
| 217 | C<ReceiveRequestAttemptId> if none of the messages have been modified | ||
| 218 | (deleted or had their visibility changes). | ||
| 219 | |||
| 220 | =item * | ||
| 221 | |||
| 222 | During a visibility timeout, subsequent calls with the same | ||
| 223 | C<ReceiveRequestAttemptId> return the same messages and receipt | ||
| 224 | handles. If a retry occurs within the deduplication interval, it resets | ||
| 225 | the visibility timeout. For more information, see Visibility Timeout | ||
| 226 | (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html) | ||
| 227 | in the I<Amazon SQS Developer Guide>. | ||
| 228 | |||
| 229 | If a caller of the C<ReceiveMessage> action still processes messages | ||
| 230 | when the visibility timeout expires and messages become visible, | ||
| 231 | another worker consuming from the same queue can receive the same | ||
| 232 | messages and therefore process duplicates. Also, if a consumer whose | ||
| 233 | message processing time is longer than the visibility timeout tries to | ||
| 234 | delete the processed messages, the action fails with an error. | ||
| 235 | |||
| 236 | To mitigate this effect, ensure that your application observes a safe | ||
| 237 | threshold before the visibility timeout expires and extend the | ||
| 238 | visibility timeout as necessary. | ||
| 239 | |||
| 240 | =item * | ||
| 241 | |||
| 242 | While messages with a particular C<MessageGroupId> are invisible, no | ||
| 243 | more messages belonging to the same C<MessageGroupId> are returned | ||
| 244 | until the visibility timeout expires. You can still receive messages | ||
| 245 | with another C<MessageGroupId> as long as it is also visible. | ||
| 246 | |||
| 247 | =item * | ||
| 248 | |||
| 249 | If a caller of C<ReceiveMessage> can't track the | ||
| 250 | C<ReceiveRequestAttemptId>, no retries work until the original | ||
| 251 | visibility timeout expires. As a result, delays might occur but the | ||
| 252 | messages in the queue remain in a strict order. | ||
| 253 | |||
| 254 | =back | ||
| 255 | |||
| 256 | The maximum length of C<ReceiveRequestAttemptId> is 128 characters. | ||
| 257 | C<ReceiveRequestAttemptId> can contain alphanumeric characters (C<a-z>, | ||
| 258 | C<A-Z>, C<0-9>) and punctuation | ||
| 259 | (C<!"#$%&'()*+,-./:;E<lt>=E<gt>?@[\]^_`{|}~>). | ||
| 260 | |||
| 261 | For best practices of using C<ReceiveRequestAttemptId>, see Using the | ||
| 262 | ReceiveRequestAttemptId Request Parameter | ||
| 263 | (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-receiverequestattemptid-request-parameter.html) | ||
| 264 | in the I<Amazon SQS Developer Guide>. | ||
| 265 | |||
| 266 | |||
| 267 | |||
| 268 | =head2 VisibilityTimeout => Int | ||
| 269 | |||
| 270 | The duration (in seconds) that the received messages are hidden from | ||
| 271 | subsequent retrieve requests after being retrieved by a | ||
| 272 | C<ReceiveMessage> request. | ||
| 273 | |||
| 274 | |||
| 275 | |||
| 276 | =head2 WaitTimeSeconds => Int | ||
| 277 | |||
| 278 | The duration (in seconds) for which the call waits for a message to | ||
| 279 | arrive in the queue before returning. If a message is available, the | ||
| 280 | call returns sooner than C<WaitTimeSeconds>. If no messages are | ||
| 281 | available and the wait time expires, the call returns successfully with | ||
| 282 | an empty list of messages. | ||
| 283 | |||
| 284 | To avoid HTTP errors, ensure that the HTTP response timeout for | ||
| 285 | C<ReceiveMessage> requests is longer than the C<WaitTimeSeconds> | ||
| 286 | parameter. For example, with the Java SDK, you can set HTTP transport | ||
| 287 | settings using the NettyNioAsyncHttpClient | ||
| 288 | (https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClient.html) | ||
| 289 | for asynchronous clients, or the ApacheHttpClient | ||
| 290 | (https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/apache/ApacheHttpClient.html) | ||
| 291 | for synchronous clients. | ||
| 292 | |||
| 293 | |||
| 294 | |||
| 295 | |||
| 296 | =head1 SEE ALSO | ||
| 297 | |||
| 298 | This class forms part of L<Paws>, documenting arguments for method ReceiveMessage in L<Paws::SQS> | ||
| 299 | |||
| 300 | =head1 BUGS and CONTRIBUTIONS | ||
| 301 | |||
| 302 | The source code is located here: L<https://github.com/pplu/aws-sdk-perl> | ||
| 303 | |||
| 304 | Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> | ||
| 305 | |||
| 306 | =cut | ||
| 307 | |||