[
https://issues.apache.org/jira/browse/STORM-386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14120809#comment-14120809
]
ASF GitHub Bot commented on STORM-386:
--------------------------------------
Github user harshach commented on a diff in the pull request:
https://github.com/apache/incubator-storm/pull/177#discussion_r17091417
--- Diff: examples/storm-starter/multilang/resources/asyncSplitsentence.js
---
@@ -0,0 +1,32 @@
+/**
+ * Example for async bolt. Receives sentence and breaks it into words.
+ *
+ */
+
+
+var storm = require('./storm');
+var BasicBolt = storm.BasicBolt;
+
+function SplitSentenceBolt() {
+ BasicBolt.call(this);
+};
+
+SplitSentenceBolt.prototype = Object.create(BasicBolt.prototype);
+SplitSentenceBolt.prototype.constructor = SplitSentenceBolt;
+
+SplitSentenceBolt.prototype.process = function(tup, done) {
+ var self = this;
+
+ // Here setTimeout is not really needed, we use it to demonstrate
asynchronous code in the process method:
+ setTimeout(function() {
+ var words = tup.values[0].split(" ");
+ words.forEach(function(word) {
+ self.emit({tuple: [word], anchorTupleId: tup.id},
function(taskIds) {
--- End diff --
Looks like you are anchoring the tuple here but there is no ack in
WordCountTopologyNode.WordCount Bolt. This might be the one causing the fail
count go up and also completeLatency. I removed the anchorTupleId and in
storm.js anchors as part of the message. There is no failed tuples and lower
completeLatency of 41.
> Development of multilang protocol in nodejs
> -------------------------------------------
>
> Key: STORM-386
> URL: https://issues.apache.org/jira/browse/STORM-386
> Project: Apache Storm (Incubating)
> Issue Type: New Feature
> Environment: nodejs
> Reporter: Anya Tchernishov
>
> Support nodejs multilang protocol.
> Design considerations:
> - Emit will receive an object (like args and kwargs in python) and a callback
> that is called when task ids list is received.
> self.emit({tuple: [word]}, function(taskIds) {
> self.log(word + ' sent to task ids - ' + taskIds);
> });
> - The following methods will received done method that must be invoked on
> completion (same pattern used by the mocha test framework for async unit
> tests).
> - Internal implementation of emit uses Process.stdout.write without a
> callback since nodejs streams maintain FIFO order (so far, we have not found
> a need for providing a callback).
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)