DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Where to dynamically launch a module? EHL or MHL?

I'm dynamically launching a few clones, and I'd like to pass them some info using start.vi (this is fine, no questions there). But I'm not sure where to launch them. The MHL of my launcher carries the pre-launch info I want to pass them, while the EHL of my launcher needs to register for their broadcasts.

 

Should I launch the clones in the MHL where I can give them their data, then message my EHL saying the clones have launched and to register for their broadcasts?

Or launch them from the EHL so the registration can happen... but having the launch info held by the EHL feels terribly wrong. 

 

I don't want to send the info to the clones after launch using a request as it's info I'd like them to have on startup. This is my first DQMH project, but I always enjoyed using ephemeral actors with actor framework and it's an element I'd like to keep using, but am just trying to work out if I can.

-------------------
CLD
Message 1 of 3
(159 Views)

To keep your code readable and maintainable, I think it is worthy to follow some rules - even if you could do it another way.

In case of DQMH I always follow the rule to catch the events in EHL but execute the actions inside MHL. My recommendation is to start the clones inside the MHL. So if you add something later like a configuration or identification request to the clones, your EHL keeps responsible. And if the EHL catches a broadcast from any clone, you can forward a message to MHL to process the follow-up actions.

Message 2 of 3
(149 Views)

Thanks yeah that's a good angle to come at it from. If I'm strict about the MHL always being the doer then even though I didn't like having to have the two parts to the launch (launch the clones and then telling the EHL to register) it at least keeps the responsibilities of the EHL&MHL clean. That's more important to prioritize throughout my design than how many steps something might involve- I was losing sight of that. Thanks! 

-------------------
CLD
Message 3 of 3
(135 Views)