Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
武汉红喜
whatsmars
提交
435050f3
W
whatsmars
项目概览
武汉红喜
/
whatsmars
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
435050f3
编写于
12月 04, 2019
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove storm
上级
752464dc
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
0 addition
and
1840 deletion
+0
-1840
pom.xml
pom.xml
+0
-1
whatsmars-storm/README.md
whatsmars-storm/README.md
+0
-1
whatsmars-storm/pom.xml
whatsmars-storm/pom.xml
+0
-74
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/LocalTopologyRunner.java
.../java/org/hongxi/whatsmars/storm/LocalTopologyRunner.java
+0
-43
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/topology/CommitFeedListener.java
...g/hongxi/whatsmars/storm/topology/CommitFeedListener.java
+0
-51
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/topology/EmailCounter.java
...ava/org/hongxi/whatsmars/storm/topology/EmailCounter.java
+0
-47
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/topology/EmailExtractor.java
...a/org/hongxi/whatsmars/storm/topology/EmailExtractor.java
+0
-23
whatsmars-storm/src/main/resources/changelog.txt
whatsmars-storm/src/main/resources/changelog.txt
+0
-1600
未找到文件。
pom.xml
浏览文件 @
435050f3
...
...
@@ -30,7 +30,6 @@
<module>
whatsmars-spring-boot-samples
</module>
<module>
whatsmars-elasticsearch
</module>
<module>
whatsmars-zk
</module>
<module>
whatsmars-storm
</module>
<module>
whatsmars-flink
</module>
<module>
whatsmars-spring-data
</module>
</modules>
...
...
whatsmars-storm/README.md
已删除
100644 → 0
浏览文件 @
752464dc
https://github.com/alibaba/jstorm
\ No newline at end of file
whatsmars-storm/pom.xml
已删除
100644 → 0
浏览文件 @
752464dc
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
whatsmars-parent
</artifactId>
<groupId>
org.hongxi
</groupId>
<version>
Rocket.S7
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
whatsmars-storm
</artifactId>
<dependencies>
<dependency>
<groupId>
org.apache.storm
</groupId>
<artifactId>
storm-core
</artifactId>
<version>
1.2.2
</version>
<!-- in a real topology that will be deploy to a real cluster, scope should be set to provided
as shown below. we're keeping it in default 'compile' scope to allow for easy execution with
maven in local cluster mode -->
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.6
</version>
</dependency>
<dependency>
<groupId>
com.codahale.metrics
</groupId>
<artifactId>
metrics-core
</artifactId>
<version>
3.0.2
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>
org.hongxi.whatsmars.storm.LocalTopologyRunner
</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>
make-assembly
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.18
</version>
<configuration>
<environmentVariables>
<STORM_TEST_TIMEOUT_MS>
60000
</STORM_TEST_TIMEOUT_MS>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/LocalTopologyRunner.java
已删除
100644 → 0
浏览文件 @
752464dc
package
org.hongxi.whatsmars.storm
;
import
org.apache.storm.Config
;
import
org.apache.storm.LocalCluster
;
import
org.apache.storm.generated.StormTopology
;
import
org.apache.storm.topology.TopologyBuilder
;
import
org.apache.storm.tuple.Fields
;
import
org.apache.storm.utils.Utils
;
import
org.hongxi.whatsmars.storm.topology.CommitFeedListener
;
import
org.hongxi.whatsmars.storm.topology.EmailCounter
;
import
org.hongxi.whatsmars.storm.topology.EmailExtractor
;
public
class
LocalTopologyRunner
{
private
static
final
int
TEN_MINUTES
=
600000
;
public
static
void
main
(
String
[]
args
)
{
TopologyBuilder
builder
=
new
TopologyBuilder
();
builder
.
setSpout
(
"commit-feed-listener"
,
new
CommitFeedListener
());
builder
.
setBolt
(
"email-extractor"
,
new
EmailExtractor
())
.
shuffleGrouping
(
"commit-feed-listener"
);
builder
.
setBolt
(
"email-counter"
,
new
EmailCounter
())
.
fieldsGrouping
(
"email-extractor"
,
new
Fields
(
"email"
));
Config
config
=
new
Config
();
config
.
setDebug
(
true
);
StormTopology
topology
=
builder
.
createTopology
();
LocalCluster
cluster
=
new
LocalCluster
();
cluster
.
submitTopology
(
"github-commit-count-topology"
,
config
,
topology
);
Utils
.
sleep
(
TEN_MINUTES
);
cluster
.
killTopology
(
"github-commit-count-topology"
);
cluster
.
shutdown
();
}
}
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/topology/CommitFeedListener.java
已删除
100644 → 0
浏览文件 @
752464dc
package
org.hongxi.whatsmars.storm.topology
;
import
org.apache.storm.spout.SpoutOutputCollector
;
import
org.apache.storm.task.TopologyContext
;
import
org.apache.storm.topology.OutputFieldsDeclarer
;
import
org.apache.storm.topology.base.BaseRichSpout
;
import
org.apache.storm.tuple.Fields
;
import
org.apache.storm.tuple.Values
;
import
org.apache.commons.io.IOUtils
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.util.List
;
import
java.util.Map
;
/**
* This spout simulates reading commits from a live stream by doing two things:
* <p/>
* 1) Reading a file containing commit data into a list of strings (one string per commit).
* 2) When nextTuple() is called, emit a tuple for each string in the list.
*/
public
class
CommitFeedListener
extends
BaseRichSpout
{
private
SpoutOutputCollector
outputCollector
;
private
List
<
String
>
commits
;
@Override
public
void
declareOutputFields
(
OutputFieldsDeclarer
outputFieldsDeclarer
)
{
outputFieldsDeclarer
.
declare
(
new
Fields
(
"commit"
));
}
@Override
public
void
open
(
Map
map
,
TopologyContext
context
,
SpoutOutputCollector
outputCollector
)
{
this
.
outputCollector
=
outputCollector
;
try
{
commits
=
IOUtils
.
readLines
(
ClassLoader
.
getSystemResourceAsStream
(
"changelog.txt"
),
Charset
.
defaultCharset
().
name
());
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
@Override
public
void
nextTuple
()
{
for
(
String
commit
:
commits
)
{
outputCollector
.
emit
(
new
Values
(
commit
));
}
}
}
\ No newline at end of file
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/topology/EmailCounter.java
已删除
100644 → 0
浏览文件 @
752464dc
package
org.hongxi.whatsmars.storm.topology
;
import
org.apache.storm.task.TopologyContext
;
import
org.apache.storm.topology.BasicOutputCollector
;
import
org.apache.storm.topology.OutputFieldsDeclarer
;
import
org.apache.storm.topology.base.BaseBasicBolt
;
import
org.apache.storm.tuple.Tuple
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
EmailCounter
extends
BaseBasicBolt
{
private
Map
<
String
,
Integer
>
counts
;
@Override
public
void
declareOutputFields
(
OutputFieldsDeclarer
declarer
)
{
// This bolt does not emit any values and therefore does not define any output fields.
}
@Override
public
void
prepare
(
Map
stormConf
,
TopologyContext
context
)
{
counts
=
new
HashMap
<
String
,
Integer
>();
}
@Override
public
void
execute
(
Tuple
tuple
,
BasicOutputCollector
outputCollector
)
{
String
email
=
tuple
.
getStringByField
(
"email"
);
counts
.
put
(
email
,
countFor
(
email
)
+
1
);
printCounts
();
}
private
Integer
countFor
(
String
email
)
{
Integer
count
=
counts
.
get
(
email
);
return
count
==
null
?
0
:
count
;
}
/**
* Print the counts to System.out so you can easily see what's happening.
*/
private
void
printCounts
()
{
for
(
String
email
:
counts
.
keySet
())
{
System
.
out
.
println
(
String
.
format
(
"%s has count of %s"
,
email
,
counts
.
get
(
email
)));
}
}
}
\ No newline at end of file
whatsmars-storm/src/main/java/org/hongxi/whatsmars/storm/topology/EmailExtractor.java
已删除
100644 → 0
浏览文件 @
752464dc
package
org.hongxi.whatsmars.storm.topology
;
import
org.apache.storm.topology.BasicOutputCollector
;
import
org.apache.storm.topology.OutputFieldsDeclarer
;
import
org.apache.storm.topology.base.BaseBasicBolt
;
import
org.apache.storm.tuple.Fields
;
import
org.apache.storm.tuple.Tuple
;
import
org.apache.storm.tuple.Values
;
public
class
EmailExtractor
extends
BaseBasicBolt
{
@Override
public
void
declareOutputFields
(
OutputFieldsDeclarer
declarer
)
{
declarer
.
declare
(
new
Fields
(
"email"
));
}
@Override
public
void
execute
(
Tuple
tuple
,
BasicOutputCollector
outputCollector
)
{
String
commit
=
tuple
.
getStringByField
(
"commit"
);
String
[]
parts
=
commit
.
split
(
" "
);
outputCollector
.
emit
(
new
Values
(
parts
[
1
]));
}
}
\ No newline at end of file
whatsmars-storm/src/main/resources/changelog.txt
已删除
100644 → 0
浏览文件 @
752464dc
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录