我最近开始使用Apache Storm 。我将 Storm 与Clojure Storm DSL和Leiningen一起使用。
风暴拓扑管理有一个非常酷的工具:Storm Flux。
我的问题是:当我使用 clojure 在 Storm 中编码时,如何使用 Flux?
我最近开始使用Apache Storm 。我将 Storm 与Clojure Storm DSL和Leiningen一起使用。
风暴拓扑管理有一个非常酷的工具:Storm Flux。
我的问题是:当我使用 clojure 在 Storm 中编码时,如何使用 Flux?
我找到了一个解决方案:
(ns your.namespace.boltname
(:use
[org.apache.storm clojure config])
(:gen-class :implements [org.apache.storm.topology.IRichBolt]))
(defbolt my-bolt
["data"]
[tuple collector]
(emit-bolt! collector [(f (.getString tuple 0))] :anchor tuple)
(ack! collector tuple))
(defn -execute [this tuple]
(.execute my-bolt tuple))
(defn -prepare [this conf context collector]
(.prepare my-bolt conf context collector))
(defn -cleanup [this]
(.cleanup my-bolt))
(defn -declareOutputFields [this output]
(.declareOutputFields my-bolt output))
(defn -getComponentConfiguration [this]
(.getComponentConfiguration my-bolt))
不要忘记添加:aot :all
到your project.clj
.
在您的流量中topology.yaml
,例如:
...
bolts:
- id: "myBolt"
className: "your.namespace.boltname"
parallelism: 1
...
就这样 :)