DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Data from MHL to HL

Solved!
Go to solution

Just started playing around with DQMH.

 

My module connects to a REST server and the MHL contains in the "Data" cluster the "REST Client cluster".

The requests unbundle the "REST Client cluster" from "Data", do their thing and bundle it again.

 

The HL is supposed to check the connection status every 10 seconds and reconnect if necessary.

For reconnection the HL simply enqueues a "Connect" Message that is correctly executed by the MHL.

 

But for the connection check I need the "Rest Client cluster" available in the HL.

 

How do I do that? Local variable?

Or do I fire a private event in the MHL when connecting that transfers the data to the HL and the HL keeps the data in a shift register?

 

Or should the HL simply enqueue an event "check and reconnect" every 10 seconds that executes in the MHL and so no data is needed in the HL?

0 Kudos
Message 1 of 8
(295 Views)
Solution
Accepted by topic author Tesla1977

Hello there, and thanks for using DQMH!

 

There are three basic ways (and a 4th, probably less ideal one) to achieve what you're looking for:

 

  1. Keep all the resources in the MHL and only send messages from the HL for executing actions inside the MHL. 
    1. In your example, send a "Check Connection" message up the MHL, where you then execute the actual check
  2. Keep all the resources in the HL
    1. In your example, that would mean implementing all functions that use the REST resources in the HL and adding a separate data cluster on a shift register there.
  3. Send the required resources from the MHL to the HL, either once after setting up or as a payload of each request

The fourth way is using a local variable (or any other mechanism for bypassing the by-value paradigm). Depending on your use case, that might or might not be acceptable. 

 

Here at HSE, we usually go with the first or the second way, depending on the specifics (personally, I prefer #2). 




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


Message 2 of 8
(278 Views)

Thanks,

 

implementing everything in the HL would have the advantage that the connection check is not done when functions are called constantly, because then the 10s timeout is not executed.

The connection check is only necessary when no other functions get called.

0 Kudos
Message 3 of 8
(268 Views)

@joerg.hampel wrote:

... (personally, I prefer #2). 


Am curious about why you prefer so?

 

Would the MHL be used for other purposes within such a module? Or would it be substantially unused, except for initialization, finalization and error handling?

0 Kudos
Message 4 of 8
(238 Views)

@Dhakkan wrote:

@joerg.hampel wrote:

... (personally, I prefer #2). 


Am curious about why you prefer so?

 

Would the MHL be used for other purposes within such a module? Or would it be substantially unused, except for initialization, finalization and error handling?


It makes the code much leaner. Yes, it is a bit unorthodox maybe to move most of the logic from MHL to HL - at the same time, the code is simpler. The MHL might actually have no added cases or requests at all (and be "substantially unused" as you say). 

 

This is probably a personal/team-specific preference. Here at HSE we will expect / understand such an architecture and be able to explain to our customers why we do it that way. Other teams surely have other preferences.




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


Message 5 of 8
(211 Views)

How do I call a request from within a request?

Say my "Check Connection" is running in the MHL, detects that the connection is down and now wants to call another request after the current request is finished (Connect).

 

Do I use the "Connect" Request from the Public API or do I use the "DQMH Enqueue Message" with Message "Connect" to trigger the new request?

 

0 Kudos
Message 6 of 8
(193 Views)

Hi, I would simply enqueue a message for the MHL.

0 Kudos
Message 7 of 8
(170 Views)

@greenfish3 wrote:

Hi, I would simply enqueue a message for the MHL.


Surely do that (enqueue a message) instead of going through the EHL.

 

Ideally, though, make the relevant contents of the "Connect" MHL case a subVI and use that directly in the "Check Connection" case. 




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


0 Kudos
Message 8 of 8
(154 Views)