Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e24ffb1
Change storm-core to compile
anyatch Jun 26, 2014
04ce472
Add BasicBolt js implementation (tested) and Spout implementation (no…
anyatch Jun 26, 2014
e2b561f
Change storm-core to compile
anyatch Jun 26, 2014
83e8040
Fix SplitSentenceBolt inheritance
anyatch Jun 26, 2014
902fa77
Fix spout handleCommand
anyatch Jun 26, 2014
7c6e999
Fix Spout js implementation. WordCountTopology works with js bolt and…
anyatch Jun 29, 2014
f3f3e5c
Add js implemetation of storm - basic bolt and spout.
anyatch Jun 29, 2014
2cfc908
Pass callback to BasicBolt.process to enable async functionality. Mov…
anyatch Jun 30, 2014
e996e16
Add async bold
anyatch Jun 30, 2014
9eee5df
Fix call to fail after process - pass tuple
anyatch Jun 30, 2014
b644a1f
Remove storm.js copy
anyatch Jul 1, 2014
6fcc42c
Fix inheritence mess. Fix randomsentence spout initialize
anyatch Jul 1, 2014
94ed360
Add documentation to modules
anyatch Jul 1, 2014
847b509
Remove async run implementation
anyatch Jul 1, 2014
e4d15d0
Change callback to done.
anyatch Jul 1, 2014
32dbb93
Pass sentence list to the ocnstructor of the spout
anyatch Jul 1, 2014
a2e2ab8
Add documentation to random int method
anyatch Jul 1, 2014
dc19eb7
Use isFirstMessage instead of counting messages
anyatch Jul 1, 2014
2d3a511
Pass the error on fail
anyatch Jul 2, 2014
920e383
Restore pom.xml to the original state
anyatch Jul 2, 2014
fc920ca
Restore original WordCountTopology.java. Add WordCountTopologyNode.ja…
anyatch Jul 2, 2014
fe2d0d6
Delete xml that wasn't here on original storm
anyatch Jul 2, 2014
5603bee
Changen parameter name - taskId to taskI(ds (because its a list). Add…
anyatch Jul 2, 2014
f8522f8
Change taskId to taskIds
anyatch Jul 2, 2014
47a426b
In case no callback is passed when emitting, use a default callback
anyatch Jul 2, 2014
e71cc8c
Remove dead code
anyatch Jul 2, 2014
f573112
Change callback to done to match common format
anyatch Jul 2, 2014
ab1183b
Change method name from callback to done
anyatch Jul 2, 2014
c446f91
Delete unnecessary and illegal log messages (before changing to storm…
anyatch Jul 2, 2014
977a498
Delete logToFile and all references to it. Use storm logging system
anyatch Jul 2, 2014
ea7269f
Add documentation
anyatch Jul 2, 2014
36764ba
Add documentation, delete unnecessary require
anyatch Jul 3, 2014
6b73c35
Restore fs
anyatch Jul 3, 2014
add2e69
Fix documentation
anyatch Jul 3, 2014
d6a659e
Fix documentation
anyatch Jul 3, 2014
20c2225
Fix documentation
anyatch Jul 3, 2014
4e3270c
Extract create tuple id into a function
anyatch Jul 3, 2014
2184834
Change emit api - receive json instead of separate parsms
anyatch Jul 3, 2014
761b672
Docuemnt emit and emitDirect
anyatch Jul 3, 2014
2b7ceaa
Merge pull request #1 from forter/nodejs-initial
itaifrenkel Jul 3, 2014
8e1824d
Delete log messages from storm base classes. Delete unused method
anyatch Jul 14, 2014
74b0e9f
Fix anchor tuple bug - dont save it in the bolts stats, pass the resp…
anyatch Jul 14, 2014
b54e0b6
Fix type.\nChange method name to camel case. Change quotes to format …
anyatch Jul 15, 2014
686ec2c
Fix type. Change method name to camel case. Change quotes to format f…
anyatch Jul 15, 2014
4076545
Merge branch 'nodejs-internal-reviewed' of https://github.com/Ryzyco/…
anyatch Jul 16, 2014
945495c
Fix bug in storm spout/bolt initialization - first write a file name…
anyatch Jul 16, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions examples/storm-starter/multilang/resources/asyncSplitsentence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Example for async bolt. Receives sentence and breaks it into words.
*
* Created by anya on 6/30/14.
*/


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) {
self.log(word + ' sent to task ids - ' + taskIds);
});
});
done();
}, 5000)
}

new SplitSentenceBolt().run();
72 changes: 72 additions & 0 deletions examples/storm-starter/multilang/resources/randomsentence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Example for storm spout. Emits random sentences.
* The original class in java - storm.starter.spout.RandomSentenceSpout.
*
* Created by anya on 6/26/14.
*/

var storm = require('./storm');
var Spout = storm.Spout;


var SENTENCES = [
"the cow jumped over the moon",
"an apple a day keeps the doctor away",
"four score and seven years ago",
"snow white and the seven dwarfs",
"i am at two with nature"]

function RandomSentenceSpout(sentences) {
Spout.call(this);
this.runningTupleId = 0;
this.sentences = sentences;
this.pending = {};
};

RandomSentenceSpout.prototype = Object.create(Spout.prototype);
RandomSentenceSpout.prototype.constructor = RandomSentenceSpout;

RandomSentenceSpout.prototype.getRandomSentence = function() {
return this.sentences[getRandomInt(0, this.sentences.length - 1)];
}

RandomSentenceSpout.prototype.nextTuple = function(done) {
var self = this;
var sentence = this.getRandomSentence();
var tup = [sentence];
var id = this.createNextTupleId();
this.pending[id] = tup;
this.emit({tuple: tup, id: id}, function(taskIds) {
self.log(tup + ' sent to task ids - ' + taskIds);
});
done();
}

RandomSentenceSpout.prototype.createNextTupleId = function() {
var id = this.runningTupleId;
this.runningTupleId++;
return id;
}

RandomSentenceSpout.prototype.ack = function(id, done) {
this.log('Received ack for - ' + id);
delete this.pending[id];
done();
}

RandomSentenceSpout.prototype.fail = function(id, done) {
this.log('Received fail for - ' + id + '. Retrying.');
this.emit({tuple: this.pending[id], id:id}, function(taskIds) {
self.log(this.pending[id] + ' sent to task ids - ' + taskIds);
});
done();
}

/**
* Returns a random integer between min (inclusive) and max (inclusive)
*/
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

new RandomSentenceSpout(SENTENCES).run();
26 changes: 26 additions & 0 deletions examples/storm-starter/multilang/resources/splitsentence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Bolt example - 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;
var words = tup.values[0].split(" ");
words.forEach(function(word) {
self.emit({tuple: [word], anchorTupleId: tup.id}, function(taskIds) {
self.log(word + ' sent to task ids - ' + taskIds);
});
});
done();
}

new SplitSentenceBolt().run();
Loading