dsmq 0.3.0__tar.gz → 0.4.0__tar.gz
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-0.3.0/README.md → dsmq-0.4.0/PKG-INFO +25 -0
- dsmq-0.3.0/PKG-INFO → dsmq-0.4.0/README.md +18 -8
- {dsmq-0.3.0 → dsmq-0.4.0}/pyproject.toml +1 -1
- {dsmq-0.3.0 → dsmq-0.4.0}/src/dsmq/dsmq.py +4 -1
- {dsmq-0.3.0 → dsmq-0.4.0}/src/dsmq/example_get_client.py +0 -1
- {dsmq-0.3.0 → dsmq-0.4.0}/src/dsmq/example_put_client.py +0 -2
- {dsmq-0.3.0 → dsmq-0.4.0}/uv.lock +1 -1
- dsmq-0.3.0/src/dsmq/py.typed +0 -0
- {dsmq-0.3.0 → dsmq-0.4.0}/.gitignore +0 -0
- {dsmq-0.3.0 → dsmq-0.4.0}/.python-version +0 -0
- {dsmq-0.3.0 → dsmq-0.4.0}/LICENSE +0 -0
- {dsmq-0.3.0 → dsmq-0.4.0}/src/dsmq/__init__.py +0 -0
- {dsmq-0.3.0 → dsmq-0.4.0}/src/dsmq/demo_linux.py +0 -0
- {dsmq-0.3.0 → dsmq-0.4.0}/src/dsmq/example_server.py +0 -0
@@ -1,3 +1,10 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: dsmq
|
3
|
+
Version: 0.4.0
|
4
|
+
Summary: A dead simple message queue
|
5
|
+
Requires-Python: >=3.10
|
6
|
+
Description-Content-Type: text/markdown
|
7
|
+
|
1
8
|
# Dead Simple Message Queue
|
2
9
|
|
3
10
|
## What it does
|
@@ -50,6 +57,24 @@ topic = "greetings"
|
|
50
57
|
msg = mq.get(topic)
|
51
58
|
```
|
52
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
|
+
|
53
78
|
### Demo
|
54
79
|
|
55
80
|
1. Open 3 separate terminal windows.
|
@@ -1,11 +1,3 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: dsmq
|
3
|
-
Version: 0.3.0
|
4
|
-
Summary: A dead simple message queue
|
5
|
-
License-File: LICENSE
|
6
|
-
Requires-Python: >=3.10
|
7
|
-
Description-Content-Type: text/markdown
|
8
|
-
|
9
1
|
# Dead Simple Message Queue
|
10
2
|
|
11
3
|
## What it does
|
@@ -58,6 +50,24 @@ topic = "greetings"
|
|
58
50
|
msg = mq.get(topic)
|
59
51
|
```
|
60
52
|
|
53
|
+
### Spin up and shut down a dsmq in its own process
|
54
|
+
|
55
|
+
A dsmq server doesn't come with a built-in way to shut itself down.
|
56
|
+
It can be helpful to have it running in a separate process that can be
|
57
|
+
managed
|
58
|
+
|
59
|
+
```python
|
60
|
+
import multiprocessing as mp
|
61
|
+
|
62
|
+
p_mq = mp.Process(target=dsmq.start_server, args=(config.MQ_HOST, config.MQ_PORT))
|
63
|
+
p_mq.start()
|
64
|
+
|
65
|
+
p_mq.join()
|
66
|
+
# or
|
67
|
+
p_mq.kill()
|
68
|
+
p_mq.close()
|
69
|
+
```
|
70
|
+
|
61
71
|
### Demo
|
62
72
|
|
63
73
|
1. Open 3 separate terminal windows.
|
@@ -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-0.3.0/src/dsmq/py.typed
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|