SQS Callback decorator
Python decorator for registering message handlers from Simple Queue Service endpoints.
- decorator register callbacks for specific queues
listento iterate over all callbacks, read messages from queues and dispatchpostto quickly send data to a queue and obtain message ID
install
pip install bayis-sqs-callback
usage
import sqsfn
@sqsfn.sqs_queue_listener(sqs_queue_name="my-queue-name")
def my_example_queue_listener(data_from_queue):
"""process a queue item"""
print("recieved data")
return True
if __name__ == "__main__":
asyncio.run(sqsfn.listen())
multiple queues
import sqsfn
@sqsfn.sqs_queue_listener(sqs_queue_name="queue-a")
def my_example_queue_listener(data_from_queue_a):
print("received from queue a")
sqsfn.post("queue-b", data_from_queue_a)
return True
@sqsfn.sqs_queue_listener(sqs_queue_name="queue-b")
def my_example_queue_listener(data_from_queue_b):
print("received from queue b")
sqsfn.post("queue-c", data_from_queue_b)
return True
@sqsfn.sqs_queue_listener(sqs_queue_name="queue-c")
def my_example_queue_listener(data_from_queue_c):
print("received from queue c")
sqsfn.post("queue-a", data_from_queue_c)
return True
if __name__ == "__main__":
asyncio.run(sqsfn.listen())
success and failure queues
the on_success and on_fail optional parameters accept a function which
will be called on successful processing of the message or otherwise.
import sqsfn
@sqsfn.sqs_queue_listener(
sqs_queue_name="my-queue-name",
on_success=lambda x: sqsfn.post("my-success-queue", x),
on_fail=lambda x: sqsfn.post("my-fail-queue", x)
)
def my_example_queue_listener(data_from_queue):
"""process a queue item"""
print("recieved data")
return True
if __name__ == "__main__":
asyncio.run(sqsfn.listen())
Metadata
Release files for bayis-sqs-callback 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bayis-sqs-callback-0.0.4.tar.gz | 5.5 kB | Without provenance | Details for bayis-sqs-callback-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bayis_sqs_callback-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for bayis_sqs_callback-0.0.4-py3-none-any.whl |
Total release size: 11.4 kB
Release files / bayis-sqs-callback-0.0.4.tar.gz
| Download URL | bayis-sqs-callback-0.0.4.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0d19fa5dccbd29c78c52a92b36427c4533699275fd7b200bca8ea498ef9c91a
|
|
BLAKE2b-256 checksum How to use checksums |
6b6c62adf6ef6ef73b8eb40aa2fe6dd865df8cb3dd3b1dc2a152e7bb4e6f3e00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|
Release files / bayis_sqs_callback-0.0.4-py3-none-any.whl
| Download URL | bayis_sqs_callback-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7061e2f2dd0a86f7830120b5278cc9da7d901cd76551150e5cf525546c4221e
|
|
BLAKE2b-256 checksum How to use checksums |
eea578a3140a7c79a5df302f4e913815af585c4839971d29a898f7d03db02562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|
Security for bayis-sqs-callback 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.