如何使用 Apache Storm javascript 模块实现示例螺栓?
How to implement an example bolt with the Apache Storm javascript module?
有一个 javascript module/library for Apache Storm, but I don't recall seeing any examples using it. Looking at the library, I'm not sure how to implement an example BasicBolt that emits stuff. We have a custom Storm topology builder and manager, so I'm integrating and running a node.js bolt with that. I was able to get one running with the storm-node modules (https://www.npmjs.com/package/storm-node => https://github.com/STRML/storm-node, https://github.com/Lazyshot/storm-node)。但如果可能的话,我更愿意使用准系统主 Apache Storm 库。我得到的如下所示。能够将消息记录到风暴中,但无法将数据发送到拓扑中的下一个螺栓以供使用。我在想我没有正确调用 emit() 函数。使用 storm-node,发出我想要的东西要容易得多。知道我做错了什么或遗漏了什么吗?
var ExampleBolt = require("./storm.js").BasicBolt;
ExampleBolt.prototype.process = function(tuple, done) {
this.log("loggedamessage");
var data = JSON.stringify(tuple.values);
//originally tried something like this...
//this.emit([data]);
this.emit({'tuple':data,'anchorTupleId':tuple.values},function taskIdHandler(taskId){ return; });
done();
};
var bolt = new ExampleBolt();
bolt.run();
不幸的是,我使用的 Storm 基础设施没有报告任何有用的关于节点螺栓的运行时错误,以便我找出问题。
是一个测试拆分语句螺栓,用作我们测试的一部分。它应该给你一个很好的起点。
有一个 javascript module/library for Apache Storm, but I don't recall seeing any examples using it. Looking at the library, I'm not sure how to implement an example BasicBolt that emits stuff. We have a custom Storm topology builder and manager, so I'm integrating and running a node.js bolt with that. I was able to get one running with the storm-node modules (https://www.npmjs.com/package/storm-node => https://github.com/STRML/storm-node, https://github.com/Lazyshot/storm-node)。但如果可能的话,我更愿意使用准系统主 Apache Storm 库。我得到的如下所示。能够将消息记录到风暴中,但无法将数据发送到拓扑中的下一个螺栓以供使用。我在想我没有正确调用 emit() 函数。使用 storm-node,发出我想要的东西要容易得多。知道我做错了什么或遗漏了什么吗?
var ExampleBolt = require("./storm.js").BasicBolt;
ExampleBolt.prototype.process = function(tuple, done) {
this.log("loggedamessage");
var data = JSON.stringify(tuple.values);
//originally tried something like this...
//this.emit([data]);
this.emit({'tuple':data,'anchorTupleId':tuple.values},function taskIdHandler(taskId){ return; });
done();
};
var bolt = new ExampleBolt();
bolt.run();
不幸的是,我使用的 Storm 基础设施没有报告任何有用的关于节点螺栓的运行时错误,以便我找出问题。
是一个测试拆分语句螺栓,用作我们测试的一部分。它应该给你一个很好的起点。