This library provides a way of bypassing AWS size restrictions when using services such as SQS and SNS.
Project description
boto3_large_message_utils
This library provides a way of bypassing AWS size restrictions when using services such as SQS and SNS, by providing methods to cache message bodies in S3 and parse them again at the other end.
Usage
Install
Install the package using pip
pip install boto3_large_message_utils
Initialise Handler
Import and set up the LargeMessageBuilder
from boto3_large_message_utils import LargeMessageBuilder
builder = LargeMessageBuilder(
s3_bucket_for_cache='my-bucket', #REQUIRED
s3_object_prefix='my-prefix',
compress=True,
#message_size_threshold=100000, # Pass an optional message size threshold
#session=session, # Pass an optional boto3 session to initialise the client from the session
)
Handle a message
# create your message in the normal way, build expects a string
msg = json.dumps({ 'content': 'this is my message' })
# submit your message to the handler
new_msg = builder.build(msg)
# send message to SQS, SNS or another AWS service
Message with Message Attributes
# create your message in the normal way, build expects a string
msg = json.dumps({ 'content': 'this is my message' })
msg_attr = {
"MSG_ATTR": {
"StringValue": "my-value"
}
}
# submit your message to the handler
msg = builder.build(msg, msg_attr)
# send message to SQS, SNS or another AWS service
Parse a message
Handle a message that has been optimised by the Base.
# received message from SQS or another AWS service.
parser = LargeMessageParser(
#session=session, # Pass an optional boto3 session to initialise the client from the session
)
msg = parser.parse(received_message)
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
Close
Hashes for boto3_large_message_utils-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae8f82bcb97f06f3e858f047cc3d22eb7af8265c011d4ba0189e994bc0605855 |
|
MD5 | 081a97da990f9c41bb49cd9d7e2abaef |
|
BLAKE2b-256 | fed72267f4f745c6f259c9da755471ddcdaee2e2560792255392e9fb08029920 |
Close
Hashes for boto3_large_message_utils-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78cde4970009f22cff1eae1af96679bdc1b4dc8aa0aaeb96228b87a841030551 |
|
MD5 | 7952f72a9e5ba1be48ffe0951831b742 |
|
BLAKE2b-256 | cbe0d8e0a47c74e786aa5e2ab4ff6ee7364c0daaedc245be3e1baa561a0ad3a9 |