The schema and messaging library for the Quant-Net Control Plane
Project description
The QUANT-NET Message Queue Module (quantnet_mq)
The QUANT-NET Message Queue module provide RPC and Publish/Subscribe capabilities for the control plane, and the package is a common dependency for the QNCP Controller, Agent, and API packages. The module includes:
- Remote procedure call (RPC) client and server implementations
- Publish/Subscribe (pub/sub) client and server implementations
- Core schemas for the QUANT-NET Control Plane network data model
- Auto-generated Python objects for all defined schema
Installing
pip3 install . # or pip3 install -e .
Building
python3 -m build
Testing
MQ_HOST=<broker_host> pytest -v
Example Usage
- RPC client
import asyncio
from quantnet_mq.rpcclient import RPCClient
async def main():
client = RPCClient("example_client")
client.set_handler("myRequest", None,
"quantnet_mq.schema.models.myns.myRequest")
await client.start()
# send a message and wait up to for a response 5s
msg = {"arg1": "value1", "arg2": 999.99}
req = await client.call("myRequest, msg, timeout=5.0)
print (req)
if __name__ == "__main__":
asyncio.run(main())
- Pub/Sub receiver
import asyncio
from quantnet_mq.rpcclient import MsgServer
async def handle_msg(data):
print (data)
async def main():
client = MsgServer()
mclient.subscribe("mytopic", self.handle_msg)
await mclient.start()
# wait as long as needed here ...
if __name__ == "__main__":
asyncio.run(main())
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
quantnet_mq-1.0.0.post1.tar.gz
(25.7 kB
view details)
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 quantnet_mq-1.0.0.post1.tar.gz.
File metadata
- Download URL: quantnet_mq-1.0.0.post1.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
881da7fa8d5297e0a593b625060a8b6f16827ed32677d5b0e64ebfb20633f62a
|
|
| MD5 |
28a19638540e1c2dce56251b370ffba8
|
|
| BLAKE2b-256 |
5493b063c7fc9f938737780b4a4e97c4fbdf498625e259c77946b7117f94b46f
|
File details
Details for the file quantnet_mq-1.0.0.post1-py3-none-any.whl.
File metadata
- Download URL: quantnet_mq-1.0.0.post1-py3-none-any.whl
- Upload date:
- Size: 46.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2848ad3884dfed803767c9ec17ea9c1513b0cbecdc54d9d85c911ba869c3ff10
|
|
| MD5 |
d6e20335059c59d4f26aff695f2f4b83
|
|
| BLAKE2b-256 |
1c089d2a4a1c0b7fa07d965ee5b58b679b7e75cd3d243cab3e2087d7486b25fb
|