https://github.com/awslabs/amazon-sqs-python-extended-client-lib
An extension to the Amazon SQS client that enables sending and receiving messages up to 2GB via Amazon S3.
https://github.com/awslabs/amazon-sqs-python-extended-client-lib
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.5%) to scientific vocabulary
Keywords
Repository
An extension to the Amazon SQS client that enables sending and receiving messages up to 2GB via Amazon S3.
Basic Info
Statistics
- Stars: 45
- Watchers: 3
- Forks: 6
- Open Issues: 13
- Releases: 1
Topics
Metadata Files
README.md
Amazon SQS Extended Client Library for Python
Implements the functionality of amazon-sqs-java-extended-client-lib in Python
The Amazon SQS Extended Client allows clients to manage Amazon SQS message payloads that exceed the 256 KB message size limit, up to a size of 2 GB. In the event of publishing such large messages, the client accomplishes this feat by storing the actual payload in a S3 bucket and by storing the reference of the stored object in the SQS queue. Similarly, the extended-client is also used for retrieving and dereferencing these references of message objects stored in S3. Thus, the library is used for the following purposes:
- Specify whether payloads are always stored in Amazon S3 or only when a payload's size exceeds 256 KB.
- Send a message that references a single message object stored in an Amazon S3 bucket.
- Get the corresponding payload object from an Amazon S3 bucket.
- Delete the corresponding payload object from an Amazon S3 bucket.
Message Attributes for the SQS Extended Client
The SQS Extended Client makes use of several additional message attributes which helps it to handle large message payloads. This section shall outline the various attributes present:
large_payload_support: This consists of the S3 Bucket name that is responsible for storing large messagesalways_through_s3: This decides if all the message should be serialized to the S3 bucket. If set toFalse, messages smaller than256 KBwill not be serialized to the s3 bucket.use_legacy_attribute: This message attribute is present in the header for a message structure and is important for consumers to understand the name of the key in the dictionary which contains the information of the large message payload. If True, then all published messages use the Legacy reserved message attribute (SQSLargePayloadSize) instead of the current reserved message attribute (ExtendedPayloadSize).
Global Variables used by the SQS Extended Client
MESSAGE_POINTER_CLASS: The value held by this global variable, or byLEGACY_MESSAGE_POINTER_CLASS, is critical to the functioning of the client as it holds the class name of the pointer that stored the original payload in a S3 bucket.MAX_ALLOWED_ATTRIBUTES: The value held by this global variable denotes the constraint of having a maximum of 10 message attributes for each large message payload.S3_KEY_ATTRIBUTE_NAME: The value held by this global variable denotes the S3 Key, if present, which would be used to store the large message payload.DEFAULT_MESSAGE_SIZE_THRESHOLD: This states the threshold for the size of the messages in the S3 bucket and it cannot be less than 0 or more than 262144 (default value).RESERVED_ATTRIBUTE_NAME: The value held by this global variable, or byLEGACY_RESERVED_ATTRIBUTE_NAME, denotes the attribute name which will be reserved for the purpose of handling large message payloads.
Getting Started
- Sign up for AWS -- Before you begin, you need an AWS account. For more information about creating an AWS account, see create and activate aws account.
- Minimum requirements -- Python 3.x (or later) and pip
- Download -- Download the latest preview release or pick it up from pip:
pip install amazon-sqs-extended-client
Using the Extended Client
Ensure that the package has been imported in the file you want to run your code from, by doing:
Setting up the prerequisites for sending message payloads > 256 KB
``` import boto3 import sqsextendedclient
sqsextendedclient = boto3.client("sqs", regionname="us-east-1") sqsextendedclient.largepayloadsupport = "BUCKETNAMEHERE" sqsextendedclient.uselegacy_attribute = False
Creating a SQS Queue and extracting it's Queue URL
queue = sqsextendedclient.createqueue( QueueName = "DemoPreparationQueue" ) queueurl = sqsextendedclient.getqueueurl( QueueName = "DemoPreparationQueue" )['QueueUrl']
Creating a S3 bucket using the S3 client
sqsextendedclient.s3client.createbucket(Bucket=sqsextendedclient.largepayloadsupport) ```
Enabling support for payloads > 256 KB
```
Sending a large message
largemessage = smallmessage * 300000 # Shall cross the limit of 256 KB
sendmessageresponse = sqsextendedclient.sendmessage( QueueUrl=queueurl, MessageBody=largemessage ) assert sendmessage_response['ResponseMetadata']['HTTPStatusCode'] == 200 ```
```
Receiving the large message
receivemessageresponse = sqsextendedclient.receivemessage( QueueUrl=queueurl, MessageAttributeNames=['All'] ) assert receivemessageresponse['Messages'][0]['Body'] == largemessage receipthandle = receivemessageresponse['Messages'][0]['ReceiptHandle'] ```
```
Deleting the large message
Set to True for deleting the payload from S3
sqsextendedclient.deletepayloadfroms3 = True deletemessageresponse = sqsextendedclient.deletemessage( QueueUrl=queueurl, ReceiptHandle=receipthandle )
assert deletemessageresponse['ResponseMetadata']['HTTPStatusCode'] == 200 ```
```
Deleting the queue
deletequeueresponse = sqsextendedclient.deletequeue( QueueUrl=queueurl )
assert deletequeueresponse['ResponseMetadata']['HTTPStatusCode'] == 200 ```
Security
See CONTRIBUTING for more information.
License
This project is licensed under the Apache-2.0 License.
Owner
- Name: Amazon Web Services - Labs
- Login: awslabs
- Kind: organization
- Location: Seattle, WA
- Website: http://amazon.com/aws/
- Repositories: 914
- Profile: https://github.com/awslabs
AWS Labs
GitHub Events
Total
- Issues event: 6
- Watch event: 14
- Issue comment event: 8
- Pull request event: 2
- Fork event: 1
Last Year
- Issues event: 6
- Watch event: 14
- Issue comment event: 8
- Pull request event: 2
- Fork event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 8
- Total pull requests: 20
- Average time to close issues: 1 day
- Average time to close pull requests: 5 days
- Total issue authors: 8
- Total pull request authors: 6
- Average comments per issue: 0.75
- Average comments per pull request: 0.3
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 6
Past Year
- Issues: 7
- Pull requests: 4
- Average time to close issues: 1 day
- Average time to close pull requests: 8 days
- Issue authors: 7
- Pull request authors: 3
- Average comments per issue: 0.86
- Average comments per pull request: 0.5
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- tejendra2012 (1)
- khanhcd92 (1)
- allanlewis (1)
- bweisscyberark (1)
- dsedivec (1)
- plondino (1)
- damebrown (1)
- Pamroni (1)
- reese-allison (1)
Pull Request Authors
- dependabot[bot] (11)
- jagdev-aws (6)
- cherchiga (2)
- reese-allison (2)
- dastra (2)
- michael-k (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 80,072 last-month
- Total dependent packages: 1
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
pypi.org: amazon-sqs-extended-client
Python version of AWS SQS extended client
- Homepage: https://github.com/awslabs/amazon-sqs-python-extended-client-lib
- Documentation: https://amazon-sqs-extended-client.readthedocs.io/
- License: Apache-2.0
-
Latest release: 1.0.1
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- trufflesecurity/trufflehog 1594fddf051a1a0e7e59d25c27bc20d39a27d349 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- aws-actions/configure-aws-credentials v4 composite
- pypa/gh-action-pypi-publish release/v1 composite
- salsify/action-detect-and-tag-new-version v2 composite
- actions/checkout v3 composite
- black 23.3.0
- boto3 1.33.13
- botocore 1.33.13
- certifi 2023.11.17
- cffi 1.15.1
- charset-normalizer 3.3.2
- click 8.1.7
- colorama 0.4.6
- coverage 7.2.7
- cryptography 42.0.0
- exceptiongroup 1.2.0
- flake8 3.9.2
- flake8 5.0.4
- idna 3.6
- importlib-metadata 6.7.0
- iniconfig 2.0.0
- isort 5.11.5
- isort 5.13.2
- jinja2 3.1.3
- jmespath 1.0.1
- markupsafe 2.1.4
- mccabe 0.6.1
- mccabe 0.7.0
- moto 4.2.13
- mypy-extensions 1.0.0
- packaging 23.2
- pathspec 0.11.2
- platformdirs 4.0.0
- pluggy 1.2.0
- pycodestyle 2.7.0
- pycodestyle 2.9.1
- pycparser 2.21
- pyflakes 2.3.1
- pyflakes 2.5.0
- pytest 7.4.4
- pytest-cov 4.1.0
- python-dateutil 2.8.2
- pyyaml 6.0.1
- requests 2.31.0
- responses 0.23.3
- s3transfer 0.8.2
- six 1.16.0
- tomli 2.0.1
- typed-ast 1.5.5
- types-pyyaml 6.0.12.12
- typing-extensions 4.7.1
- urllib3 1.26.18
- urllib3 2.0.7
- werkzeug 2.2.3
- xmltodict 0.13.0
- zipp 3.15.0
- black ^23.1 develop
- flake8 --- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: "*" python: "^3.7" - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: ">=5" python: ">=3.8" develop
- isort --- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: 5.11.5 python: '3.7' - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: "^5.11.6" python: ">=3.8" develop
- moto ^4.1.11 develop
- pytest ^7.3.2 develop
- pytest-cov ^4.1.0 develop
- boto3 ^1.26.91
- python ^3.7