tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/8-how-can-i-communicate-between-contextsRobotlegs: Discussion 2018-10-18T16:35:06Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/5772282009-11-12T10:07:27Z2010-09-04T19:25:27ZHow can I communicate between Contexts?<div><p>Hi guys,</p>
<p>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.<br />
The question is how can I communicate between Contexts?</p>
<p>Do I need a "master" context which will handle all the submodules and act as the event bus for them?</p>
<p>thanks</p>
<p>Simone</p></div>simonetag:robotlegs.tenderapp.com,2009-10-18:Comment/5772282009-11-12T10:18:01Z2009-11-12T10:18:01ZHow can I communicate between Contexts?<div><p>Hi Simone,</p>
<p>There is a small example in the Demo Bundle over at:</p>
<p><a href=
"http://github.com/robotlegs/robotlegs-demos-Bundle">http://github.com/robotlegs/robotlegs-demos-Bundle</a></p>
<p>Have a look in AcmeWidgetFactory. It's not the greatest of
demos, but it shows one way to work with modules.</p>
<p>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).</p>
<p>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.</p>
<p>I hope that helps somewhat. Let us know how you get on.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/5772282009-11-12T10:22:27Z2010-09-04T19:25:28ZHow can I communicate between Contexts?<div><p>Thanks Shaun,</p>
<p>I'll will have a look at that and let you know</p>
<p>cheers<br />
Simone</p></div>simone