# sqs-extended-client
### Implements the functionality of [amazon-sqs-java-extended-client-lib](https://github.com/awslabs/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](https://github.com/awslabs/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](https://github.com/QuiNovas/botoinator) library. This allows for further extension or decoration if desired.
## Additional attributes available on `boto3` SQS `client` and `Queue` objects
* large_payload_support -- the S3 bucket name that will store large messages.
* message_size_threshold -- the threshold for storing the message in the large messages bucket. Cannot be less than `0` or greater than `262144`. Defaults to `262144`.
* always_through_s3 -- if `True`, then all messages will be serialized to S3. Defaults to `False`
* s3 -- the boto3 S3 `resource` object to use to store objects to S3. Use this if you want to control the S3 resource (for example, custom S3 config or credentials). Defaults to `boto3.resource("s3")` on first use if not previously set.
## 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)
```python
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'
```
### Enabling support for large payloads (>64K)
```python
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
```
### Enabling support for large payloads for all messages
```python
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
```
### Setting a custom S3 resource
```python
import boto3
from botocore.config import Config
import sqs_extended_client
# Low level client
sqs = boto3.client('sqs')
sqs.large_payload_support = 'my-bucket-name'
sqs.s3 = boto3.resource(
's3',
config=Config(
signature_version='s3v4',
s3={
"use_accelerate_endpoint": 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.s3 = boto3.resource(
's3',
config=Config(
signature_version='s3v4',
s3={
"use_accelerate_endpoint": True
}
)
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/QuiNovas/sqs-extended-client",
"name": "sqs-extended-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "sqs,java",
"author": "Joseph Wortmann",
"author_email": "jwortmann@quinovas.com",
"download_url": "https://files.pythonhosted.org/packages/63/2a/2909a7e02920b619136f5acf3d036fe7d54bcbbe18bfacda141c4e74e005/sqs-extended-client-0.0.11.tar.gz",
"platform": null,
"description": "# sqs-extended-client\n\n### Implements the functionality of [amazon-sqs-java-extended-client-lib](https://github.com/awslabs/amazon-sqs-java-extended-client-lib) in Python\n\n## Installation\n```\npip install sqs-extended-client\n```\n\n\n## Overview\nsqs-extended-client allows for sending large messages through SQS via S3. This is the same mechanism that the Amazon library\n[amazon-sqs-java-extended-client-lib](https://github.com/awslabs/amazon-sqs-java-extended-client-lib) provides. This library is\ninteroperable with that library.\n\nTo do this, this library automatically extends the normal boto3 SQS client and Queue resource classes upon import using the [botoinator](https://github.com/QuiNovas/botoinator) library. This allows for further extension or decoration if desired.\n\n## Additional attributes available on `boto3` SQS `client` and `Queue` objects\n* large_payload_support -- the S3 bucket name that will store large messages.\n* message_size_threshold -- the threshold for storing the message in the large messages bucket. Cannot be less than `0` or greater than `262144`. Defaults to `262144`.\n* always_through_s3 -- if `True`, then all messages will be serialized to S3. Defaults to `False`\n* s3 -- the boto3 S3 `resource` object to use to store objects to S3. Use this if you want to control the S3 resource (for example, custom S3 config or credentials). Defaults to `boto3.resource(\"s3\")` on first use if not previously set.\n\n## Usage\n\n#### Note:\n> The s3 bucket must already exist prior to usage, and be accessible by whatever credentials you have available\n\n### Enabling support for large payloads (>256Kb)\n\n```python\nimport boto3\nimport sqs_extended_client\n\n# Low level client\nsqs = boto3.client('sqs')\nsqs.large_payload_support = 'my-bucket-name'\n\n# boto resource\nresource = boto3.resource('sqs')\nqueue = resource.Queue('queue-url')\n\n# Or\nqueue = resource.create_queue(QueueName='queue-name')\n\nqueue.large_payload_support = 'my-bucket-name'\n```\n\n### Enabling support for large payloads (>64K)\n```python\nimport boto3\nimport sqs_extended_client\n\n# Low level client\nsqs = boto3.client('sqs')\nsqs.large_payload_support = 'my-bucket-name'\nsqs.message_size_threshold = 65536\n\n# boto resource\nresource = boto3.resource('sqs')\nqueue = resource.Queue('queue-url')\n\n# Or\nqueue = resource.create_queue(QueueName='queue-name')\n\nqueue.large_payload_support = 'my-bucket-name'\nqueue.message_size_threshold = 65536\n```\n### Enabling support for large payloads for all messages\n```python\nimport boto3\nimport sqs_extended_client\n\n# Low level client\nsqs = boto3.client('sqs')\nsqs.large_payload_support = 'my-bucket-name'\nsqs.always_through_s3 = True\n\n# boto resource\nresource = boto3.resource('sqs')\nqueue = resource.Queue('queue-url')\n\n# Or\nqueue = resource.create_queue(QueueName='queue-name')\n\nqueue.large_payload_support = 'my-bucket-name'\nqueue.always_through_s3 = True\n```\n### Setting a custom S3 resource\n```python\nimport boto3\nfrom botocore.config import Config\nimport sqs_extended_client\n\n# Low level client\nsqs = boto3.client('sqs')\nsqs.large_payload_support = 'my-bucket-name'\nsqs.s3 = boto3.resource(\n 's3', \n config=Config(\n signature_version='s3v4',\n s3={\n \"use_accelerate_endpoint\": True\n }\n )\n)\n\n# boto resource\nresource = boto3.resource('sqs')\nqueue = resource.Queue('queue-url')\n\n# Or\nqueue = resource.create_queue(QueueName='queue-name')\n\nqueue.large_payload_support = 'my-bucket-name'\nqueue.s3 = boto3.resource(\n 's3', \n config=Config(\n signature_version='s3v4',\n s3={\n \"use_accelerate_endpoint\": True\n }\n )\n)\n```\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "AWS SQS extended client functionality from amazon-sqs-java-extended-client-lib",
"version": "0.0.11",
"project_urls": {
"Homepage": "https://github.com/QuiNovas/sqs-extended-client"
},
"split_keywords": [
"sqs",
"java"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "de49c056bfb05b65aaeb94d18e8b5ed15b35a274fb46c39e1375f13e8093805a",
"md5": "a2bc088a03453087919931b3383dea3b",
"sha256": "5197848f7f38fd7f75dc0d76fe1b4a020be4b5b0c02a1aea20484dfca075475d"
},
"downloads": -1,
"filename": "sqs_extended_client-0.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2bc088a03453087919931b3383dea3b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 10037,
"upload_time": "2023-11-17T17:42:09",
"upload_time_iso_8601": "2023-11-17T17:42:09.471467Z",
"url": "https://files.pythonhosted.org/packages/de/49/c056bfb05b65aaeb94d18e8b5ed15b35a274fb46c39e1375f13e8093805a/sqs_extended_client-0.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "632a2909a7e02920b619136f5acf3d036fe7d54bcbbe18bfacda141c4e74e005",
"md5": "44bd7a1ae5fe103caaa312e45f7ed391",
"sha256": "d4af8b405776cdf134afd065950e7f3d3a752aec7c9fe3f0dddc33ab1e99f698"
},
"downloads": -1,
"filename": "sqs-extended-client-0.0.11.tar.gz",
"has_sig": false,
"md5_digest": "44bd7a1ae5fe103caaa312e45f7ed391",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10444,
"upload_time": "2023-11-17T17:42:10",
"upload_time_iso_8601": "2023-11-17T17:42:10.833237Z",
"url": "https://files.pythonhosted.org/packages/63/2a/2909a7e02920b619136f5acf3d036fe7d54bcbbe18bfacda141c4e74e005/sqs-extended-client-0.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-17 17:42:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "QuiNovas",
"github_project": "sqs-extended-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sqs-extended-client"
}