AWS SQS extended client functionality from amazon-sqs-java-extended-client-lib
Project description
sqs-extended-client
Implements the functionality of amazon-sqs-java-extended-client-lib in Python
Installation
pip install sqs-extended-client
Overview
sqs-extended-client allows for sending large messages through SQS via S3. This is the same mechanism that the Amazon library amazon-sqs-java-extended-client-lib provides. This library is interoperable with that library.
To do this, this library automatically extends the normal boto3 SQS client and Queue resource classes upon import using the botoinator library. This allows for further extension or decoration if desired.
Usage
Note
The s3 bucket must already exist prior to usage, and be accessible by whatever credentials you have available
Enabling support for large payloads (>256Kb)
import boto3
import sqs_extended_client
# Low level client
sqs = boto3.client('sqs')
sqs.large_payload_support = 'my-bucket-name'
# boto resource
resource = boto3.resource('sqs')
queue = resource.Queue('queue-url')
# Or
queue = resource.create_queue(QueueName='queue-name')
queue.large_payload_support = 'my-bucket-name'
Arguments:
- large_payload_support -- the S3 bucket name that will store large messages.
Enabling support for large payloads (>64K)
import boto3
import sqs_extended_client
# Low level client
sqs = boto3.client('sqs')
sqs.large_payload_support = 'my-bucket-name'
sqs.message_size_threshold = 65536
# boto resource
resource = boto3.resource('sqs')
queue = resource.Queue('queue-url')
# Or
queue = resource.create_queue(QueueName='queue-name')
queue.large_payload_support = 'my-bucket-name'
queue.message_size_threshold = 65536
Arguments:
- message_size_threshold -- the threshold for storing the message in the large messages bucket. Cannot be less than 0 or greater than 262144
Enabling support for large payloads for all messages
import boto3
import sqs_extended_client
# Low level client
sqs = boto3.client('sqs')
sqs.large_payload_support = 'my-bucket-name'
sqs.always_through_s3 = True
# boto resource
resource = boto3.resource('sqs')
queue = resource.Queue('queue-url')
# Or
queue = resource.create_queue(QueueName='queue-name')
queue.large_payload_support = 'my-bucket-name'
queue.always_through_s3 = True
Arguments:
- always_through_s3 -- if True, then all messages will be serialized to S3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sqs-extended-client-0.0.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a5133af2e4fe61c4b5a1ef60144ec1cc1547bfa0291da48c7743e6b42cf9eab |
|
MD5 | b1281886f9cce47ebbad9716c2bbfaa6 |
|
BLAKE2b-256 | 1975a756394e2fb9205902c9c205d2f39bf25246f4008159a131f7e5891c0fe1 |
Hashes for sqs_extended_client-0.0.9-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c332995bef1552a1b7acc76f263a217057eb93614ac6dc09e9051c8daf57a55 |
|
MD5 | c63e028411e54e08d723b94c52e64596 |
|
BLAKE2b-256 | 782d5d509d174ed6c615ca47bcc0bea8607f81ca2935e4d7cb5cc695ec3081aa |