NPantaRhei - Introducing a Flow Execution Engine

140 views
Skip to first unread message

Ralf Westphal

unread,
May 6, 2012, 8:07:17 AM5/6/12
to Flow Based Programming
Dear FBP afficionados:

Since you´re always on a lookout for FBP runtimes/frameworks let me
present you NPantaRhei, a flow execution engine. It´s written in C#
and open source (https://github.com/ralfw/NPantaRhei).

Here are the first introductory articles:

How to use it -
http://geekswithblogs.net/theArchitectsNapkin/archive/2012/04/27/introduction-to-the-flow-execution-engine-npantarhei.aspx

How to do concurrent processing -
http://geekswithblogs.net/theArchitectsNapkin/archive/2012/05/02/easily-parallelize-operations-in-flows-using-the-flow-execution-engine.aspx

How to handle exceptions -
http://geekswithblogs.net/theArchitectsNapkin/archive/2012/05/05/catch-exceptions-in-concurrent-flows-using-causalities.aspx

NPantaRhei is not a particular FBP runtime, though. Rather I´d say it
allows FBP programs to be executed. So it´s more of a data flow
runtime with the ability to easily execute operations in parallel, if
you wish.

To wet your appetite here´s a code sketch for this diagram from the
FBP website:
http://www.jpaulmorrison.com/graphicsstuff/DrawFBPsample.jpg

using(var fr = new FlowRuntime())
{
// encode the diagram lines
fr.AddStream(".in", "Generate 1st group");
fr.AddStream(".in", "Generate 2nd group");
fr.AddStream("Generate 1st group", "Sort");
fr.AddStream("Generate 2nd group", "Sort");
fr.AddStream("Sort", "Write text to pane");

// encode the diagram boxes
var foc = new FlowOperationContainer()
.AddFunc<int,int>("Generate 1st group",
Generate_1st_group).MakeAsync()
.AddFunc<int,int>("Generate 2nd group",
Generate_2nd_group).MakeAsync()
.AddFunc<int,IEnumerable<int>>("Sort", Sort).MakeAsync()
.AddAction<IEnumerable<int>>("Write text to pane",
Write_text_to_pane);
fr.AddOperations(foc.Operations);

// start runtime on background thread
fr.Start();

// start processing by sending 100 as the initial value to the
"Generate" operations
fr.Process(new Message(".in", 100));

...
}

Please note, all operations (terminal boxes in a FBP diagram) can be
implemented easily as functions or procedures. No need to whip up a
class. But of course you can, if you like or need to, because there
are more input/output ports to an operation.

MakeAsync() puts an operation on a background thread. This is not the
default like you´d expect from a true FBP runtime.

And now: let the discussion begin - if you like :-)

-Ralf

Paul Morrison

unread,
May 6, 2012, 10:12:58 AM5/6/12
to flow-based-...@googlegroups.com
Very interesting, Ralf! I love the name (naturally)!

Paul

On 06/05/2012 8:07 AM, Ralf Westphal wrote:
> Dear FBP afficionados:
>
> Since you�re always on a lookout for FBP runtimes/frameworks let me
> present you NPantaRhei, a flow execution engine. It�s written in C#
> NPantaRhei is not a particular FBP runtime, though. Rather I�d say it
> allows FBP programs to be executed. So it�s more of a data flow
> runtime with the ability to easily execute operations in parallel, if
> you wish.
>
> To wet your appetite here�s a code sketch for this diagram from the
> default like you�d expect from a true FBP runtime.
>
> And now: let the discussion begin - if you like :-)
>
> -Ralf
>


--
http://jpaulmorrison.blogspot.com/
Reply all
Reply to author
Forward
0 new messages