Open drjdpowell opened 1 year ago
I don't want to lock into a single design pattern or architecture. Plus, I come from a text programming background where things like callbacks, delegates, lambdas, and all sorts of other fun mechanisms run rampant. Yes, a VI wrapper is needed, but with the context you can pass in, you can give the callback a message queue if that's what you want. Or an event reference. Or update a DVR. I use this with all sorts of app architectures and module patterns so I aim for flexibility in allowing any higher layer design patterns.
It's certainly not the most prevalent pattern in LV but why should that be a limiting factor? Teaching teachable people is easy :)
Another reason with this design, many modules can be supplied with the connection to communicate over and can subscribe to messages on a single connection. Which message handling loop would get the message? One big loop would be needed at the application layer to cover all the reusable libraries? If a library is written to use this implementation, messages can be multiplexed without caring about the rest of the application. All an app needs to do is provide the module with the connections/endpoints to use.
It would certainly be possible to implement a different messaging layer that directly ties into a QMH pattern. Or a QMH layer on top of the messaging layer.
Suggestion then: 1) Have the ability to register a single Callback for all messages. This allows an easy way to adapt your library into an existing massage-based architecture. 2) Have an example that uses this to pass messages to a message-handling loop. Maybe choose a lightweight framework like the JKI State Machine and show how you can pass messages into it via a User Event. This example would serve as a template for the User to adapt their own existing message-passing methods.
Actually, maybe get in touch with the DQMH people. That is a widely used framework without a well-developed TCP solution, which uses individually-type messages (User Events) that might match well with your Callbacks.
I'm looking into integrating with DQMH but they already appear to have a Generic Networking Module available though of course that's meant strictly for DQMH module - DQMH module messaging. With my APIs it would be easier to expose web UIs and messaging with other non-DQMH systems so I'm going to get in touch with a few of the consortium people and plan a path forward for this.
HSE's Generic Networking (GenNet) modules were designed around the use case of using a module's API (its request VIs) on one computer but actually executing the functions on another computer. Although GenNet can be used to just communicate between applications, that was not the first use case in mind.
While handy for our own projects, the GenNet modules in their current form are not trivial to use for others, as there is no scripting to a) convert an existing module to a networked one (basically overwriting the DQMH Message Queue class) and b) implement requests and replies in a GenNet compatible way.
It's worth pursuing this idea here and discussing this some more.
@joerghampel I've started https://github.com/orgs/illuminated-g/discussions/1 to continue the DQMH integration discussion. Probably over this next weekend I'll take a first pass at a web UI for the thermal chamber example and we can have something to start pulling apart.
I would have thought that a Queued Message Handler (with a case structure selected by the Message ID) would be a lot more familiar to people. You, instead require Callback VIs for each message. A valid choice, but I think it would be a lot harder for many people to adopt.