exthos
Version:
stream processing in nodejs using the power of golang
34 lines (28 loc) • 754 B
JavaScript
import * as exthos from "../../dist/index.js";
let engine = new exthos.Engine(
{ metrics: { json_api: {} } },
{ isLocal: process.env["isLocal"] ? process.env["isLocal"] === "true" : true }
);
engine.useDefaultEventHandler({
"engine.fatal": (eventObj) => {
console.log("\nTest EXITED with CODE=1", JSON.stringify(eventObj));
process.exit(1);
},
});
let stream1 = new exthos.Stream(
{
input: { inport: {} },
pipeline: {
processors: [{ bloblang: `root = "hello > " + content()` }],
},
output: { stdout: {} },
},
true
);
engine.add(stream1);
await engine.start();
stream1.inport.send("my msg1 to the world");
stream1.inport.send("my msg2 to the world");
setTimeout(() => {
engine.remove(stream1);
}, 2000);