amqpstorm library for Flask
Project description
AMQP Service for Flask Apps
Features
- Connection validation and reconnection for AMQP.
- Sending messages to a specified exchange with retries.
- Consuming messages from a queue with retries.
- Customizable parameters for exchanges and queues.
- Message headers and properties support.
- Multi-threading support for consumers.
Prerequisites
- Python 3.x
- Flask
- amqpstorm
- retry
Installation
To install the required dependencies, run:
pip install amqpstorm-flask
Usage
Initialization
First, create a Flask app and initialize the RabbitMQ.
from flask import Flask
app = Flask(__name__)
app.config["MQ_URL"] = "<Your_MQ_URL>"
app.config["MQ_EXCHANGE"] = "<Your_MQ_Exchange_Name>"
amqp_service = RabbitMQ()
amqp_service.init_app(app)
Sending Messages
To send a message to a specified exchange:
amqp_service.send(
body={"key": "value"},
routing_key="route.key",
exchange_type="direct",
retries=5,
)
Consuming Messages
To consume messages from a specified queue:
@amqp_service.queue(
queue_name="test_queue",
routing_key="route.key",
)
def process_message(message):
print(message.body)
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 amqpstorm_flask-0.5.2.tar.gz.
File metadata
- Download URL: amqpstorm_flask-0.5.2.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb5496aa9293b5230ef350ea1894bfdc6d28d15dd5f59624a0f584a6e6c5ca69
|
|
| MD5 |
74bec24608bce79da2ddf4f24c557fc2
|
|
| BLAKE2b-256 |
0b2df6aaf05741f8285ecd30b59b3ef4124a454230a7aae9bb4c959410f36c51
|
Provenance
The following attestation bundles were made for amqpstorm_flask-0.5.2.tar.gz:
Publisher:
python-publish.yml on inuits/amqpstorm-flask
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amqpstorm_flask-0.5.2.tar.gz -
Subject digest:
fb5496aa9293b5230ef350ea1894bfdc6d28d15dd5f59624a0f584a6e6c5ca69 - Sigstore transparency entry: 239692206
- Sigstore integration time:
-
Permalink:
inuits/amqpstorm-flask@26cff8cbe023fc4724ca9495c7a3e8550d93f443 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/inuits
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26cff8cbe023fc4724ca9495c7a3e8550d93f443 -
Trigger Event:
release
-
Statement type:
File details
Details for the file amqpstorm_flask-0.5.2-py3-none-any.whl.
File metadata
- Download URL: amqpstorm_flask-0.5.2-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1d8afe8ba3362002e31ec56927050b1f5be0b1bd00787404ded716316fdeb74
|
|
| MD5 |
c854af95132bd76cae3a234beec86600
|
|
| BLAKE2b-256 |
145bbe9fb4970267980136096811a1b7614eda573806cae3fd6666fab0e2d8af
|
Provenance
The following attestation bundles were made for amqpstorm_flask-0.5.2-py3-none-any.whl:
Publisher:
python-publish.yml on inuits/amqpstorm-flask
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amqpstorm_flask-0.5.2-py3-none-any.whl -
Subject digest:
f1d8afe8ba3362002e31ec56927050b1f5be0b1bd00787404ded716316fdeb74 - Sigstore transparency entry: 239692207
- Sigstore integration time:
-
Permalink:
inuits/amqpstorm-flask@26cff8cbe023fc4724ca9495c7a3e8550d93f443 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/inuits
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26cff8cbe023fc4724ca9495c7a3e8550d93f443 -
Trigger Event:
release
-
Statement type: