A 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.tar.gz
(28.5 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.tar.gz.
File metadata
- Download URL: quantnet_mq-1.0.0.tar.gz
- Upload date:
- Size: 28.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b8a80271178e60d978e13d963c32ec330d75728e2ad2623251f233586b287b1
|
|
| MD5 |
03a1f005f31d3e784e964ce3393eb978
|
|
| BLAKE2b-256 |
f0182eb6c14023dc4734f7b51715d66a44583ce7d015573f7f04e860d58bc54b
|
File details
Details for the file quantnet_mq-1.0.0-py3-none-any.whl.
File metadata
- Download URL: quantnet_mq-1.0.0-py3-none-any.whl
- Upload date:
- Size: 48.2 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 |
dcc1e1ea2ba535c300188c9e5e16235d181c18fe1ba2ba4ab05e5966cc7ec91e
|
|
| MD5 |
26553f56a8816ba655c33c1a5af9047a
|
|
| BLAKE2b-256 |
da376f3bf593a9b72aba1e926605b2a521acfac363110ff3071fd8adda021155
|