How can I communicate between Contexts?

simone's Avatar

simone

12 Nov, 2009 10:07 AM

Hi guys,

I'm evaluating RobotLegs to see if it can be used in my project. I'm building a modular application and so I think I will need to define a Context for each module.
The question is how can I communicate between Contexts?

Do I need a "master" context which will handle all the submodules and act as the event bus for them?

thanks

Simone

  1. Support Staff 1 Posted by Shaun Smith on 12 Nov, 2009 10:18 AM

    Shaun Smith's Avatar

    Hi Simone,

    There is a small example in the Demo Bundle over at:

    http://github.com/robotlegs/robotlegs-demos-Bundle

    Have a look in AcmeWidgetFactory. It's not the greatest of demos, but it shows one way to work with modules.

    In essence, each Context has it's own EventDispatcher, and there is a "shell" (or master) Context that Mediates each module by way of Interfaces (so as not to compile the modules into the shell).

    This is certainly not the only way to do it however. It might help to know that from the outside, a Context appears to compose it's EventDispatcher, and while this is true, the Context is in fact the dispatcher itself - this is so that the "target" for an event points back to its Context.

    I hope that helps somewhat. Let us know how you get on.

  2. 2 Posted by simone on 12 Nov, 2009 10:22 AM

    simone's Avatar

    Thanks Shaun,

    I'll will have a look at that and let you know

    cheers
    Simone

  3. Joel Hooks closed this discussion on 17 Nov, 2009 11:18 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac