Skip to content

Process Data Streams

Steven England edited this page Feb 4, 2017 · 1 revision

To get the most out of CLIs it is neccessary that one not only gets the exit code of a called program. One better also processes the data streams. KnimeNet supports reading the standard output and standard error from KNIME.

You have the choice to provide any TextWriter instance of your choice. These might be KnimeNet's own event based text writers

/* event based textwriters that are invoked as
 * as soon as new data is emmitted by KNIME
 */
var output = new EventBasedTextWriter();
var error = new EventBasedTextWriter();
/* wire them to event handlers */
output.OnWriteLine += OnOutputReceived;
error.OnWriteLine += OnErrorReceived;
/* execute workflow */
var exitStatus = await shellProxy.StartKnime(null, output, error);

or console applications console text writers

var exitStatus = await shellProxy.StartKnime(null, Console.Out, Console.Error);

or just plain text writers. Refer to the MSDN page for more information.

Clone this wiki locally