-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04fba9f
commit ee3b6b8
Showing
2 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Upy-RabbitMQ | ||
# upy-rabbitmq | ||
|
||
![GitHub Org's stars](https://img.shields.io/github/stars/UpyExplorer?label=LinuxProfile&style=flat-square) | ||
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/upy-rabbitmq) | ||
|
@@ -8,7 +8,7 @@ | |
|
||
--- | ||
|
||
- **Documentation**: [https://github.com/UpyExplorer/upy-rabbitmq](https://github.com/UpyExplorer/upy-rabbitmq) | ||
- **Documentation**: [https://upyexplorer.github.io/upy-rabbitmq/](https://upyexplorer.github.io/upy-rabbitmq/) | ||
- **Source Code**: [https://github.com/UpyExplorer/upy-rabbitmq](https://github.com/UpyExplorer/upy-rabbitmq) | ||
|
||
--- | ||
|
@@ -17,6 +17,7 @@ | |
|
||
```python | ||
pip install upy-rabbitmq | ||
|
||
``` | ||
|
||
## Config | ||
|
@@ -27,19 +28,36 @@ Add an environment variation called **RABBITMQ_URL** in your project's .env file | |
RABBITMQ_URL=amqp://user:[email protected]:port//vhost | ||
``` | ||
|
||
## Start Queue | ||
## Implementation | ||
|
||
### Callback Class | ||
|
||
```python | ||
|
||
import time | ||
from upy_rabbitmq.callback import CallbackProcess | ||
|
||
class MyCallBack(CallbackProcess): | ||
|
||
def process(self): | ||
time.sleep(5) | ||
print(self.body.decode()) | ||
``` | ||
|
||
### Start Queue | ||
|
||
```python | ||
|
||
from upy_rabbitmq.worker import UpyMQWorker | ||
|
||
worker = UpyMQWorker() | ||
worker.start_queue( | ||
key="key", | ||
callback=callback | ||
callback=MyCallBack | ||
) | ||
``` | ||
|
||
## New Task | ||
### New Task | ||
|
||
```python | ||
from upy_rabbitmq.client import UpyMQClient | ||
|