concept implicit task coordination in category groovy
appears as: implicit task coordination, implicit task coordination

This is an excerpt from Manning's book Groovy in Action, Second Edition.
Until now, we’ve only seen the merits of implicit task coordination with the dataflow concept for simple datatypes. This naturally leads to the question of whether we can use this concept for processing more than simple data—and yes, we can.
Listing 18.7. Dataflow streams and operators for implicit task coordination over sequential input data
import static groovyx.gpars.dataflow.Dataflow.* import groovyx.gpars.dataflow.DataflowQueue def chances = new DataflowQueue() def amounts = new DataflowQueue() def payouts = new DataflowQueue() operator( inputs: [chances, amounts], outputs: [payouts], { chance, amount -> payouts << chance * amount } ) task { [0.1, 0.2, 0.3].each { chances << it } } task { [300, 200, 100].each { amounts << it } } [30, 40, 30].each { assert it == payouts.val }