Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Connecting modules  (Read 7087 times)
meatnugget
Newbie
*
Posts: 6


View Profile Email
« on: June 15, 2009, 10:32:42 »

Hi (again)

My current issue is not so much a problem just a question of which would be the best way of doing something.

I have a shell that loads in a few modules dynamically. each module has the pipefittings to communicate back and forth with the shell. One of the modules is a login module. Once the user is logged in other modules need to get information to display regarding the user - and other modules need the information to later be able to do tasks reserved for registered users.

Currently the way I have this set up is:
- User clicks login and proxy logs user in
- Proxy sends notification with userVO
- LoginModuleJunctionMediator gets note from proxy and sends a message to shell with userVO
- Shell sends message on down the STNOUT pipe to any module interested in the login message

Not sure if the ShellJunctionMediator should send the message on directly when it is received in its pipe message handler or send it on to the Shell Mediator which in turn sends it back to the ShellJunctionMediator which sends it on to the modules (just to keep with the structure)

My question is - does this flow seem like a logical way of doing this or will I end up with spagetti piping and there is a better way to go about this that is eluding me.

Thanks!
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: June 15, 2009, 06:23:09 »

Keep in mind that the Shell does not have to play the role of a relay for all the Cores in the communications scheme. It usually does the plumbing, but after that, Cores can talk amongst themselves.

You could register input pipes for all cores that need the login announcement and connect them to a TeeSplit registered as an output pipe from the LoginModule. So the LoginModule broadcasts on this output pipe and the message is passed out to all attached modules.

-=Cliff>

Logged
meatnugget
Newbie
*
Posts: 6


View Profile Email
« Reply #2 on: June 15, 2009, 09:27:37 »

Ok that makes sense.

What if I load a module after the user has logged in and that module needs to check the logging status - would the best way to do that be to create a dedicated out/in pipe from the loaded module to login module and then an in/out pipe from login to module, then send a message requesting the login status, or would a single check like that go through the shell (or am I going about this in the wrong way)?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: June 16, 2009, 05:21:02 »

Your first suggestion is best. Try to avoid routing traffic through the shell unless there's some really good reason for doing so. (I.E. the shell needs this info as well). This way the shell's junction mediator doesnt' end up playing the role of Grand Central Station.

-=Cliff>
Logged
Pages: [1]
Print