Amazon-SQS-Client

 view release on metacpan or  search on metacpan

share/ReceiveMessage.pm  view on Meta::CPAN

        my $messageId = $message->getMessageId();

        if ( $message->isSetReceiptHandle() ) {
          my $receiptHandle = $message->getReceiptHandle();
          print {*STDOUT} sprintf "RECEIPT_HANDLE='%s'\n", $receiptHandle;
        }
        if ( $message->isSetMD5OfBody() ) {
          my $md5 = $message->getMD5OfBody();
        }
        if ( $message->isSetBody() ) {
          print {*STDOUT} sprintf "MESSAGE='%s'\n", $message->getBody();
        }

        my $attributeList = $message->getMessageAttribute();

        foreach ( @{$attributeList} ) {
          my $attribute = $_;
          if ( $attribute->isSetName() ) {
            my $name = $attribute->getName();
          }
          if ( $attribute->isSetValue() ) {
            my $value = $attribute->getValue();
          }
        }
      }
    }
  }

  if ( $response->isSetResponseMetadata() ) {
    my $responseMetadata = $response->getResponseMetadata();
    if ( $responseMetadata->isSetRequestId() ) {
      my $request_id = $responseMetadata->getRequestId();
    }
  }

  return;
}

1;

## no critic

__END__

=pod

=head1 USAGE

 example.pl [-f config-file] ReceiveMessage [queue-url]

Note: If you do not set the queue URL in the config, then you must
provide it on the command line.

Will return the message and receipt handle. Use the receipt handle to
delete the message.

 example.pl -f aws-sqs.ini SendMessage "Hello World!"

=head1 OPTIONS

 --endpoint-url, -e  API endpoint, default: https://queue.amazonaws.com
 --file, -f          Name of a .ini configuration file
 --help, -h          help

=cut



( run in 0.607 second using v1.01-cache-2.11-cpan-39bf76dae61 )