Title: Notify cores from shell by sending a notification using its particular facade Post by: openoli on August 19, 2016, 06:38:22 Hi,
I just stumbled over an old question wich probably was already discussed in the past. However, from the shell I'd like to inform all "registered" cores with the same information and wonder if it has any drawbacks to just loop over the core instances and call the sendNotification() method of their particular facades: E.g. we could have a "cors getter" inside the shell facade to make the core instances accessible and a command "NotifyCores" that resides in the shell: ShellFacade.as: public class ApplicationFacade extends Facade NotifyCoresCommand.as: public class NotifyCoresCommand extends SimpleCommand This would make the "shell->cores" communication very easy without involving the view using interfaces or using the pipes utility. The only thing that the shell and the other cores has to share would be the note name (Like the "message" in the pipes utility, if I remember it correctly). Are there any concers with this approach? Thanks, Olaf Title: Re: Notify cores from shell by sending a notification using its particular facade Post by: openoli on August 19, 2016, 07:55:22 Argh... I've just seen/remember that Cliff already gives an answer to a similar approach in the past:
The problem is that you can't guarantee that notification constants aren't in conflict across modules. Particularly in a situation where third-party modules are provided. A core's message space is its own. That' why pipes has a message facility that can pass between modules safely. So I have to make sure that a notification constant is unambiguous across all cores! Are there any other concerns? Thanks, Olaf Title: Re: Notify cores from shell by sending a notification using its particular facade Post by: puremvc on August 20, 2016, 08:11:22 Nope, that's pretty much it. If you control all the modules that will ever run in the app, and come up with a scheme that ensures the notification type values are all unique to the core they're intended for (eg., VIZ_CORE_STARTUP = "Core/Visualizer/Startup", or ALL_CORES_LOGOUT_RESET = "Core/All/ResetAfterLogout"), what you want to do will work.
Like pipe messaging, you'll want to create a common notification constants library used by all modules. Define all your notifications there instead of inside the individual Cores, that way they're all reading from the same page when it comes to intercore communications. Cheers, -=Cliff> Title: Re: Notify cores from shell by sending a notification using its particular facade Post by: openoli on August 21, 2016, 09:59:50 Thanks Cliff, l'll go that way!
Olaf |