sqs message listener using boto3
Project description
message-listener
This module can be used for listening to the messages from aws sqs.
Requirements
- install module
pip install py-message-listener
Follow bellow steps for using this module
- Add
@Listenerdecorator to method or function where do you want to receive the message, for that method/function add single parameter, This parameter is set whenever the message is received and method will be called and message will be passed as argument. - In decorator pass queue name in
destinationargument - set these environment variables:
AWS_REGION,AWS_ACCOUNT_ID,AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY - Added kwargs for configuring listener
visibility_timeout,wait_time_secondsandmax_number_of_messages poll_after_secondsthis argument specify how much time to wait before requesting for the messagesdelete_on_exceptionthis argument specifies , whether to delete the message if any exception occurs while processing the message- To delete the message return
Truefrom the message processing method
AWS_ACCOUNT_IDthis will be used for generating the queue url
Sample Code
from listener import Listener
@Listener(destination='test.fifo')
def fun(msg: str):
print(msg)
return True
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py-message-listener-0.2.tar.gz.
File metadata
- Download URL: py-message-listener-0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d1c56e05a2c6dd2b2c6fd87c710284b5bb17c4c8d17d93acb2ccfc77731fae9
|
|
| MD5 |
e5e070d2bd678776fbe9c881568bccd8
|
|
| BLAKE2b-256 |
d48549075b09e7d55d7214d96cfb1ca98ea223163c3c1ed892a95674793858f3
|
File details
Details for the file py_message_listener-0.2-py3-none-any.whl.
File metadata
- Download URL: py_message_listener-0.2-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
811969091259e4f76c1b29dd17b7e444cfc4fdcc4efeffe06fc9a5fa6054b1fb
|
|
| MD5 |
670299c0c7dd14246701b61c03296fd6
|
|
| BLAKE2b-256 |
b7f5e3685fd9170ccd33005c3b70cc4079d0b961902f476d4a4edc6b9524579c
|