这个库提供了一种在使用诸如SQS和SNS之类的服务时绕过AWS大小限制的方法。
boto3-large-message-utils的Python项目详细描述
大号信息实用程序
这个库提供了一种在使用SQS和SNS等服务时绕过AWS大小限制的方法,方法是在S3中缓存消息体并在另一端再次解析它们。在
使用
安装
使用pip安装包
pip install boto3_large_message_utils
初始化处理程序
导入并设置LargeMessageBuilder
处理消息
# create your message in the normal way, build expects a stringmsg=json.dumps({'content':'this is my message'})# submit your message to the handlernew_msg=builder.build(msg)# send message to SQS, SNS or another AWS service
具有消息属性的消息
# create your message in the normal way, build expects a stringmsg=json.dumps({'content':'this is my message'})msg_attr={"MSG_ATTR":{"StringValue":"my-value"}}# submit your message to the handlermsg=builder.build(msg,msg_attr)# send message to SQS, SNS or another AWS service
解析消息
处理基地已优化的消息。在
# 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)
- 项目
标签: