August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Kamaelia.Util.Fanout

Sending an output to many places

This component copies data sent to its inbox to multiple, specified outboxes. This allows you to 'fan out' a data source to several predetermined destinations.

Example Usage

Output data source both to a file and to the console:

Graphline( source  = MyDataSource(...),
           split   = Fanout(["toConsole","toFile"]),
           file    = SimpleFileWriter(filename="outfile"),
           console = ConsoleEchoer(),
           linkages = {
             ("source","outbox")   : ("split","inbox"),
             ("split","toConsole") : ("console","inbox"),
             ("split","toFile")    : ("file","inbox"),
           }
         ).run()

How does it work?

At initialization, specify a list of names for outboxes. Once the component is activated, any data sent to its "inbox" inbox will be replicated out to the list of outboxes you specified.

In effect, data sent to the "inbox" inbox is 'fanned out' to the specified set of destinations.

Nothing is sent to the "outbox" outbox.

If a shutdownMicroprocess or producerFinished message is received on the "control" inbox, then it is sent on to the "signal" outbox and the component terminates.

There is no corresponding 'Fanout' of data flowing into the "control" inbox.


Kamaelia.Util.Fanout.Fanout

class Fanout(Axon.Component.component)

Fanout(boxnames) -> new Fanout component.

A component that copies anything received on its "inbox" inbox to the named list of outboxes.

Keyword arguments:

  • boxnames -- list of names for the outboxes any input will be fanned out to.

Inboxes

  • control : Shutdown signalling
  • inbox : Data to be fanned out

Outboxes

  • outbox : NOT USED
  • signal : Shutdown signalling

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

__init__(self, boxnames)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

main(self)

Main loop.

Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT