dsmq 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dsmq/dsmq.py +4 -1
- dsmq/example_get_client.py +0 -1
- dsmq/example_put_client.py +0 -2
- {dsmq-0.3.0.dist-info → dsmq-0.4.0.dist-info}/METADATA +19 -2
- dsmq-0.4.0.dist-info/RECORD +10 -0
- {dsmq-0.3.0.dist-info → dsmq-0.4.0.dist-info}/WHEEL +1 -1
- dsmq/py.typed +0 -0
- dsmq-0.3.0.dist-info/RECORD +0 -11
- {dsmq-0.3.0.dist-info → dsmq-0.4.0.dist-info}/licenses/LICENSE +0 -0
dsmq/dsmq.py
CHANGED
@@ -65,7 +65,10 @@ class DSMQClientSideConnection:
|
|
65
65
|
raise RuntimeError("Connection terminated by server")
|
66
66
|
msg_str = data.decode("utf-8")
|
67
67
|
msg = json.loads(msg_str)
|
68
|
-
|
68
|
+
try:
|
69
|
+
return msg["message"]
|
70
|
+
except KeyError:
|
71
|
+
return ""
|
69
72
|
|
70
73
|
def put(self, topic, msg):
|
71
74
|
msg = json.dumps({"action": "put", "topic": topic, "message": msg})
|
dsmq/example_get_client.py
CHANGED
dsmq/example_put_client.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: dsmq
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Summary: A dead simple message queue
|
5
|
-
License-File: LICENSE
|
6
5
|
Requires-Python: >=3.10
|
7
6
|
Description-Content-Type: text/markdown
|
8
7
|
|
@@ -58,6 +57,24 @@ topic = "greetings"
|
|
58
57
|
msg = mq.get(topic)
|
59
58
|
```
|
60
59
|
|
60
|
+
### Spin up and shut down a dsmq in its own process
|
61
|
+
|
62
|
+
A dsmq server doesn't come with a built-in way to shut itself down.
|
63
|
+
It can be helpful to have it running in a separate process that can be
|
64
|
+
managed
|
65
|
+
|
66
|
+
```python
|
67
|
+
import multiprocessing as mp
|
68
|
+
|
69
|
+
p_mq = mp.Process(target=dsmq.start_server, args=(config.MQ_HOST, config.MQ_PORT))
|
70
|
+
p_mq.start()
|
71
|
+
|
72
|
+
p_mq.join()
|
73
|
+
# or
|
74
|
+
p_mq.kill()
|
75
|
+
p_mq.close()
|
76
|
+
```
|
77
|
+
|
61
78
|
### Demo
|
62
79
|
|
63
80
|
1. Open 3 separate terminal windows.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
dsmq/__init__.py,sha256=YCgbnQAk8YbtHRyMcU0v2O7RdRhPhlT-vS_q40a7Q6g,50
|
2
|
+
dsmq/demo_linux.py,sha256=7yLglGmirDLuuyMxppYSK-dfx2Fg2Q0dIWB4cl2yV1c,622
|
3
|
+
dsmq/dsmq.py,sha256=5fo3wQfw2lIXiDGB05sRwVLDN0ZoUSw7e7WO8xOLXJY,5558
|
4
|
+
dsmq/example_get_client.py,sha256=chFfB2949PBENmgdUc3ASrATq1m4wvHGBzEnOC-o_Xs,296
|
5
|
+
dsmq/example_put_client.py,sha256=mUKCRhmUieMZEpHLFWFvzeKB6IR7A8l4tWN8TvPzdKU,348
|
6
|
+
dsmq/example_server.py,sha256=kkXOPaaTzVxf9_iIM76zU9pZhkPna_1vcGWkPrhCjus,61
|
7
|
+
dsmq-0.4.0.dist-info/METADATA,sha256=T3godcTW__I3b2hj2dgJCjMJEGEo6S1HP_Iq5EQD6Ok,3878
|
8
|
+
dsmq-0.4.0.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
|
9
|
+
dsmq-0.4.0.dist-info/licenses/LICENSE,sha256=3Yu1mAp5VsKmnDtzkiOY7BdmrLeNwwZ3t6iWaLnlL0Y,1071
|
10
|
+
dsmq-0.4.0.dist-info/RECORD,,
|
dsmq/py.typed
DELETED
File without changes
|
dsmq-0.3.0.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
dsmq/__init__.py,sha256=YCgbnQAk8YbtHRyMcU0v2O7RdRhPhlT-vS_q40a7Q6g,50
|
2
|
-
dsmq/demo_linux.py,sha256=7yLglGmirDLuuyMxppYSK-dfx2Fg2Q0dIWB4cl2yV1c,622
|
3
|
-
dsmq/dsmq.py,sha256=7s-e2dmbaPMfmkrbY-CXZ5y9DmOQ9xBvoWATYGAKgGY,5483
|
4
|
-
dsmq/example_get_client.py,sha256=VwL7Z7KdSDzbpdAhetcOY8KHVPjb6_OB5rtbI30CjJ0,308
|
5
|
-
dsmq/example_put_client.py,sha256=CRVQhZTYXDawXSiJP997A0ttBwKuNf8QvSpvPmEP7ng,374
|
6
|
-
dsmq/example_server.py,sha256=kkXOPaaTzVxf9_iIM76zU9pZhkPna_1vcGWkPrhCjus,61
|
7
|
-
dsmq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
dsmq-0.3.0.dist-info/METADATA,sha256=8Mxc1JRyO8BrRiT5eLeszE5zVYUDuwJvrqXq6HW6g2s,3513
|
9
|
-
dsmq-0.3.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
10
|
-
dsmq-0.3.0.dist-info/licenses/LICENSE,sha256=3Yu1mAp5VsKmnDtzkiOY7BdmrLeNwwZ3t6iWaLnlL0Y,1071
|
11
|
-
dsmq-0.3.0.dist-info/RECORD,,
|
File without changes
|