parallel pipeline tasks?

27 views
Skip to first unread message

newgeekorder

unread,
Apr 28, 2010, 11:46:27 AM4/28/10
to Korus
Hi Guys, with regards to the pipeline example, could some tasks in the
pipeline be run in parallel

For example could we add multiple Transform Task like the following
code:

ReadTask readTask = new ReadTask();
TransformTask transformTask = new TransformTask();
TransformTask transformTask2 = new TransformTask(); // add a
secondary transform task
WriteTask writeTask = new WriteTask();

// Add these tasks to the pipeline
pipeline.add("readTask", readTask);
pipeline.add("transformTask", transformTask);
pipeline.add("transformTask2", transformTask2);
pipeline.add("writeTask", writeTask);

// Join these tasks in order to know the order of execution of the
tasks
pipeline.join(readTask, transformTask); // both transform tasks
feed off the read source
pipeline.join(readTask, transformTask2);
pipeline.join(transformTask, writeTask);

mayur choubey

unread,
Apr 30, 2010, 2:24:35 AM4/30/10
to korusdi...@googlegroups.com
Hi,

Pipleline Construct is for Simple Pipelines where tasks are executed one after the other.

But the functionality you want can be very well implemented using Korus Actors.

// Create 4 Processes by extending Process Class

ReadProcess readProcess = new ReadProcess();
TransformProcess1 transformProcess1 = new TransformProcess1();
TransformProcess2 transformProcess2 = new TransformProcess2();
WriteProcess writeProcess = new WriteProcess();

// Register them with the KorusRuntime

KorusRuntime.registerProcess("readProcess", readProcess);
KorusRuntime.registerProcess("transformProcess1", transformProcess1);
KorusRuntime.registerProcess("transformProcess2", transformProcess2);
KorusRuntime.registerProcess("writeProcess", writeProcess);

and use the KorusRuntime.send API to send requests in your case when you write the readProcess implementation after the business logic send messages to multiple transformProcesses

// inside Read Process
KorusRuntime.send("transformProcess1", msg);
KorusRuntime.send("transformProcess2", msg);

// inside both Transform Processes
KorusRuntime.send("writeProcess", msg);

A detailed implementation could be found http://code.google.com/p/korus/wiki/AsynchronousDistributedProgrammingMode

If you still have any queries, let us know we will try our best to help you out :-)

Thanks,
Team Korus
Reply all
Reply to author
Forward
0 new messages