Skip to main content

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


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.1.0.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantnet_mq-1.1.0-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

Details for the file quantnet_mq-1.1.0.tar.gz.

File metadata

  • Download URL: quantnet_mq-1.1.0.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quantnet_mq-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ffc6d46401e59c327d3f43ca8fdd018565fc12af5f12b80b9644b377933ebd38
MD5 ad27e586d83219178fbe832cd66598b6
BLAKE2b-256 ae27b0338776277da9c8c236761ba8efd4599c331d8ed6eb7889b0f7f8c3185c

See more details on using hashes here.

File details

Details for the file quantnet_mq-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: quantnet_mq-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quantnet_mq-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eab75032ee5541a90b44b66ea671807b9f049df868bb1a918fa08be43194d83f
MD5 26d236fdbee1797a61ddf991180ec9ba
BLAKE2b-256 b12e98a1031d1cb372cc315f4036b5438bf5d63b2a25247baf2e974a79f67faa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page