Writing bolts in other languages
Bolts can be written in any language. Write a bolt in another language to run as a child process. Storm uses JSON to communicate with child processes based on standard input and output. The communication protocol requires a 100-line adapter library, and Storm comes with Ruby,python, and Fancy's adapter library.
The following is the definition of splitsentence in wordcounttopology:
?
123456789 |
public
static
class
SplitSentence
extends
ShellBolt
implements
IRichBolt {
public
SplitSentence() {
super
(
"python"
,
"splitsentence.py"
);
}
public
void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(
new
Fields(
"word"
));
}
}
|
Splitsentence integrates the Shellbolt and specifies that Python is used to run with the "splitsentence.py" parameter. Here are the specific implementations of splitsentence.py:
?
123456789 |
import
storm class
SplitSentenceBolt(storm.BasicBolt):
def
process(
self
, tup):
words
=
tup.values[
0
].split(
" "
)
for
word
in
words:
storm.emit([word])
SplitSentenceBolt().run()
|
More information about writing spout and bolts in other languages, and how to create topology with other languages (avoid using the JVM entirely), and see Using NON-JVM languages with Storm.
Guaranteed Message Handling
In the previous article we have tuned some concepts about how tuples are emitted. These concepts are part of storm reliability: How storm ensures that every message is completely difficult to handle. Read guaranteeing message processing to learn how it works, and how to use storm reliability as a user.
Things topology
Storm guarantees that each message will be processed at least once by topology processing. A common question is "How to use Storm to count?" Will the count be repeated? "Storm has a feature called thing topology that allows you to handle messages precisely in most calculations. Click here for more information about the topology of things.
Distributed RPC
This document describes how to skillfully use storm to do basic stream processing. You can also use storm to do more things. A more interesting program in Storm is distributed RPC, which you can use to perform parallel computations. Click here for more information on distributed RPC.
Summarize
This manual provides an overview of development, testing, and not storm topology, and other documents will give you a deeper understanding of all aspects of storm usage
Translator language
After more than half a day of efforts, finally completed the translation of documents, follow-up will continue to bring more technical translation, such as Zookeeper,spark,kafa. If there is an inappropriate translation in the text, I hope that we will make progress together.
Storm official Help manual translation (next)