[Openchemistry-developers] MoleQueue JSON-RPC implementation
David Lonie
david.lonie at kitware.com
Fri May 4 10:23:35 EDT 2012
I've put up a first pass at a design for the server/client communication
classes for MoleQueue here:
http://wiki.openchemistry.org/MoleQueue_JSON-RPC_Implementation
The MoleQueueClient and JobRequest classes will be put into a separate
library that a client (e.g. Avogadro) can link to. The client will obtain a
JobRequest from a MoleQueueClient instance and set the job options on the
JobRequest object. The client then asks MoleQueueClient to submit the
request, which passes the JobRequest object to a JsonRpc class which
generates the JSON snippet for the request and returns a QByteArray. The
Client the passes the QByteArray to the LocalSocket.
This pattern is used to generate all requests/notifications:
1. MoleQueue[Client|Server] receives request from user
2. MQ[C|S] passes request info to JsonRpc class to generate QByteArray
3. MQ[C|S] QByteArray is passed to QLocalSocket
Reception of message is handled using the following design:
1. QLocalSocket informs MQ[C|S] of a new packet
2. MQ[C|S] passes packet to
QVector<unsigned long> MoleQueue::JsonRpc::interpretIncoming(const
QByteArray &);
This function returns the JSON-RPC id. A vector is used so we can support
batch requests.
3. The JsonRpc class interprets and identifies the packet, then emits a
signal that is unique to the packet type with Qt-friendly arguments
describing the packet contents.
4. The MQ[C|S] listens for the slots and acts appropriately on them.
Sound good?
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/openchemistry-developers/attachments/20120504/7a32f5c1/attachment.html>
More information about the Openchemistry-developers
mailing list