-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new source code for post intro Topology
- Loading branch information
unknown
committed
Jan 13, 2014
1 parent
44e6670
commit a562296
Showing
5 changed files
with
431 additions
and
4 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/edi/storm/topos/ClusterRunningTopology.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.edi.storm.topos; | ||
|
||
import backtype.storm.Config; | ||
import backtype.storm.StormSubmitter; | ||
|
||
/** | ||
* A sample topology that will only running in the cluster. | ||
* | ||
* @author Edison Xu | ||
* | ||
* Jan 13, 2014 | ||
*/ | ||
public class ClusterRunningTopology extends ExclaimBasicTopo { | ||
|
||
public static void main(String[] args) throws Exception { | ||
|
||
String topoName = "test"; | ||
|
||
ClusterRunningTopology topo = new ClusterRunningTopology(); | ||
Config conf = new Config(); | ||
conf.setDebug(false); | ||
|
||
conf.setNumWorkers(3); | ||
|
||
StormSubmitter.submitTopology(topoName, conf, topo.buildTopology()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/edi/storm/topos/LocalRunningTopology.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.edi.storm.topos; | ||
|
||
import backtype.storm.Config; | ||
import backtype.storm.LocalCluster; | ||
import backtype.storm.utils.Utils; | ||
|
||
/** | ||
* A sample topology running only under Local cluster model. | ||
* | ||
* @author Edison Xu | ||
* | ||
* Jan 13, 2014 | ||
*/ | ||
public class LocalRunningTopology extends ExclaimBasicTopo { | ||
|
||
public static void main(String[] args) throws Exception { | ||
|
||
LocalRunningTopology topo = new LocalRunningTopology(); | ||
Config conf = new Config(); | ||
conf.setDebug(true); | ||
|
||
LocalCluster cluster = new LocalCluster(); | ||
cluster.submitTopology("test", conf, topo.buildTopology()); | ||
Utils.sleep(100000); | ||
cluster.killTopology("test"); | ||
cluster.shutdown(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/edi/storm/topos/RemoteRunningTopology.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.edi.storm.topos; | ||
|
||
import java.io.File; | ||
|
||
import backtype.storm.Config; | ||
import backtype.storm.StormSubmitter; | ||
|
||
import com.edi.storm.util.EJob; | ||
|
||
/** | ||
* @author Edison Xu | ||
* | ||
* Jan 13, 2014 | ||
*/ | ||
public class RemoteRunningTopology extends ExclaimBasicTopo { | ||
|
||
public static void main(String[] args) throws Exception { | ||
|
||
String topoName = "test"; | ||
RemoteRunningTopology topo = new RemoteRunningTopology(); | ||
Config conf = new Config(); | ||
conf.setDebug(false); | ||
|
||
File jarFile = EJob.createTempJar(RemoteRunningTopology.class.getClassLoader().getResource("").getPath()); | ||
ClassLoader classLoader = EJob.getClassLoader(); | ||
Thread.currentThread().setContextClassLoader(classLoader); | ||
|
||
//System.setProperty("storm.jar", Class.forName("com.edi.storm.topos.RemoteRunningTopology").getProtectionDomain().getCodeSource().getLocation().getPath()); | ||
System.setProperty("storm.jar", jarFile.toString()); | ||
conf.setNumWorkers(5); | ||
conf.setDebug(false); | ||
conf.put(Config.NIMBUS_HOST, "10.1.110.24"); | ||
//conf.put(Config.NIMBUS_THRIFT_PORT, 8889); | ||
StormSubmitter.submitTopology(topoName, conf, topo.buildTopology()); | ||
} | ||
} |
Oops, something went wrong.