File tree 2 files changed +23
-3
lines changed
2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 17
17
18
18
``` python
19
19
pip install upy- rabbitmq
20
-
21
20
```
22
21
23
22
## Config
29
28
```
30
29
31
30
## Callback Class
31
+ > callback.py
32
32
33
33
``` python
34
34
@@ -43,6 +43,7 @@ class MyCallBack(CallbackProcess):
43
43
```
44
44
45
45
## Start Queue
46
+ > worker.py
46
47
47
48
``` python
48
49
@@ -56,6 +57,7 @@ worker.start_queue(
56
57
```
57
58
58
59
## New Task
60
+ > client.py
59
61
60
62
``` python
61
63
from upy_rabbitmq.client import UpyMQClient
Original file line number Diff line number Diff line change 1
- # Upy-RabbitMQ
1
+ # upy-rabbitmq
2
2
3
3
![ GitHub Org's stars] ( https://img.shields.io/github/stars/UpyExplorer?label=LinuxProfile&style=flat-square )
4
4
![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/upy-rabbitmq )
@@ -27,19 +27,37 @@ Add an environment variation called **RABBITMQ_URL** in your project's .env file
27
27
RABBITMQ_URL=amqp://user:[email protected] :port//vhost
28
28
```
29
29
30
+ ## Callback Class
31
+ > callback.py
32
+
33
+ ``` python
34
+
35
+ import time
36
+ from upy_rabbitmq.callback import CallbackProcess
37
+
38
+ class MyCallBack (CallbackProcess ):
39
+
40
+ def process (self ):
41
+ time.sleep(5 )
42
+ print (self .body.decode())
43
+ ```
44
+
30
45
## Start Queue
46
+ > worker.py
47
+
31
48
``` python
32
49
33
50
from upy_rabbitmq.worker import UpyMQWorker
34
51
35
52
worker = UpyMQWorker()
36
53
worker.start_queue(
37
54
key = " key" ,
38
- callback = callback
55
+ callback = MyCallBack
39
56
)
40
57
```
41
58
42
59
## New Task
60
+ > client.py
43
61
44
62
``` python
45
63
from upy_rabbitmq.client import UpyMQClient
You can’t perform that action at this time.
0 commit comments