On 08/10/2010 08:59 AM, Jim Easterbrook wrote:
On 09/08/10 08:24, Matt Hammond wrote:
If what you are after doing is swapping out a single component and
replacing it with a new one, then the Carousel component might help you:

http://www.kamaelia.org/Components/pydoc/Kamaelia.Chassis.Carousel.html

When you create a carousel, you provide it with a function for creating
new child components. When a message is sent to the "next" inbox of the
Carousel, your function is called, and is passed the message as its
argument. The new component that your function returns is activated as a
child of the component and wired up such that the inbox and outbox of
the Carousel component go straight to the inbox and outbox of the new
child.

If there was already a child, then it is sent a message to its control
inbox to tell it to shut down, then its linkages are removed, before
activating and linking in the new child.

The Carousel also has a 'requestNext' outbox that sends out a message
whenever the child terminates. You can therefore use this to trigger the
creation of a new component.
I hadn't fully appreciated the power of the Carousel component before
reading this. I'm (ab)using it to restart a component that occasionally
dies (a client of a server that sometimes breaks the connection) by
linking its 'requestNext' outbox directly to its 'next' inbox. Every
time the client terminates, the Carousel launches a new one and the rest
of my pipeline carries on. Magic!
That is awesome.

I am having a similar epiphany now that I found the coordinating assistance tracker (under Axon). This is precisely what I need: a dynamic way to register and de-register available components that aren't linked to each other. This can also be used to handle global data. Nifty! The documentation in the code is superb.

Gloria

I find that

--
You received this message because you are subscribed to the Google Groups 
"kamaelia" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/kamaelia?hl=en.

Reply via email to