| Start |
|---|
| Multiple Workers One Sink We want to gather data created by multiple Workers. First we create a Queue: Then 16 workers all generating a random number and pushing it into sink: And to get the data, convert a Queue to an Array: |
Converting a Queue into an Array Or a one liner (opens new window): |
| One Source Multiple Workers We want to process data in parallel. Let's populate source with some data: Then create some workers to process data: |
| One Source - Pipeline of Work - One Sink We want to process data in parallel and push it down the line to be processed by other workers. Since Workers both consume and produce data we have to create two queues: First wave of workers read an item from Second wave of workers uses Now |
Pushing Data into a Queue - #push
|
Pulling Data from a Queue - #pop
|
Synchronization - After a Point in Time |
Merging Two Queues
Let's start by defining and populating two queues: We should create another queue and push data from other threads into it: If you know you can completely consume both queues (consumption speed is higher than production, you won't run out of RAM) there is a simpler approach: Syntax
|
Read Article
https://develop.horje.com/learn/1434/reference