Wait for 'n' items before sending one of them onFor every 'n' items received, one is sent out (the first one received in the latest batch). Example UsageWait for two tasks to finish, before propagating the shutdown message: Graphline( A = TaskA(), B = TaskB(), SYNC = Sync(2), linkages = { ("A", "signal") : ("SYNC", "inbox"), ("B", "signal") : ("SYNC", "inbox"), ("SYNC", "outbox") : ("SYNC", "control"), ("SYNC", "signal") : ("", "signal"), } The slightly strange wiring is to make sure the Sync component is also shut down. The shutdown message is used to shutdown Sync itself. The shutdown message it emits is then the one that propogates out of the graphline. BehaviourAt initialisation, specify the number of items Sync should wait for. Once that number of items have arrived at Sync's "inbox" inbox; the first that arrived is sent on out of its "outbox" outbox. This process is repeated until Sync is shut down. If more han the specified number of items arrive in one go; the excess items roll over to the next cycle. They are not ignored or lost. If a producerFinished or shutdownMicroprocess message is received on the "control" inbox. It is immediately sent on out of the "signal" outbox and the component then immediately terminates. Kamaelia.Util.Sync.Syncclass Sync(Axon.Component.component)Sync([n]) -> new Sync component. After ever 'n' items received, the first in each batch received is sent on. Keyword arguments: - n -- The number of items to expect (default=2) Inboxes
Outboxes
Methods defined hereWarning! 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[, n])x.__init__(...) initializes x; see x.__class__.__doc__ for signature main(self)Main loop FeedbackGot 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 |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.