Skip to content

Bidirectional Communication

Steven England edited this page Feb 3, 2017 · 2 revisions

As you learned, KnimeNet is able to start parametrized workflows via the command line interface of your operating system. In most of the cases you're likely most interested in processing error messages with KnimeNet. On the other hand you could also use KNIME's built in console logger to send messages to KnimeNet. Imagine the following: In KNIME you take a Java snippet node and based on the workflow execution you might rise specific warnings/errors:

// Your custom imports:
import org.knime.core.node.NodeLogger;
// Your custom variables:
final NodeLogger logger = NodeLogger.getLogger(JSnippet.class);
// Enter your code here:
   // ... your logic here ...
logger.warn("<NodeWarning><Code>99</Code></NodeWarning>");

Then you might process this message e.g. in an event handler

private static void OnOutputReceived(object sender, TextWriterEventArgs e)
{
    /* receive the outputs from KNIME */
    MessageRouter.Examine(e.Data); // e.Data = "Output: WARN   KNIME-Worker-2 JSnippet   <NodeWarning><Code>99</Code></NodeWarning>"
}

and instruct KnimeNet to do whatever you want based on the received messages.

Clone this wiki locally