On 08/10/2010 12:13 PM, Matt Hammond wrote:
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.
You might also find these interesting: backplanes, and the
'experimental' RegisterService/ToService/Subscribe components. They
also use the coordinating-assistant-tracker to enable some common
types of task.
http://www.kamaelia.org/Components/pydoc/Kamaelia.Util.Backplane.html
As the webpage says: "Backplanes provide a way to 'publish' data under
a name, enabling other parts of the system to 'subscribe' to it on the
fly, without having to know about the actual component(s) the data is
coming from." Examples there are hopefully self explanatory. There's
also a currently-broken 'cookbook' entry on the subject.
http://www.kamaelia.org/Components/pydoc/Kamaelia.Experimental.Services.html
This 'experimental' set of components makes it easier to use the
Coordinating Assistant Tracker. The docs are less clear atm, so here's
a quick explanation. Although they are labelled as experimental, they
haven't in practice changed for quite some time. The docs are slightly
out of date - "SubscribeTo" should be "Subscribe", and "ConnectTo"
should be "ToService"
Take any component and pass it to RegisterService(); then you can
connect to its inbox using the ToService component, eg:
RegisterService("MyService", ComponentWaitingForInput(), "inbox")
Pipeline(
ComponentOutputtingStuff(),
ToService("MyService")
)
In addition, suppose you write a component that is able to dynamically
connect to the inboxes of other components and send them data they
need. If you arrange that it is controlled by sending it messages of
the form:
[ "ADD", app_specific_field, (component, inbox_name) ]
[ "REMOVE", app_specific_field, (component, inbox_name) ]
Then if you register this component using RegisterService() then you
can use the "Subscribe" component to easily connect to that service:
RegisterService("MyService", MyServiceProvidingComponent, "inbox")
Pipeline(
Subscribe("MyService", "notifications only please"),
MyComponentThatWantsToReceiveNotifications()
)
The app-specific-field is a means to allow you to pass parameters when
subscribing to the service - eg. a list of the things you are
interested in receiving from the component (for 'add') or a list of
things you no longer wish to receive (for 'remove')
The DVB DemuxerService component is an example that acts like this:
http://www.kamaelia.org/Components/pydoc/Kamaelia.Device.DVB.DemuxerService.html
There's an example of its use here:
http://www.kamaelia.org/Components/pydoc/Kamaelia.Device.DVB.Receiver.html
Matt, thank you, this is really great! I will respond in more detail
once I test this out. I am certain you've saved me huge amounts of time.
An unrelated question: What is the best way to set a timer inside of a
component? I am using the threaded Timer, but it is problematic inside
of the component, it only fires once and cannot be restarted without
error. It looks like it's underlying thread handling is botching up the
top level thread processing.
Thank you!
Gloria
--
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.