use of backtype.storm.Config in project jstorm by alibaba.
the class FluxBuilder method buildExternalTopology.
private static StormTopology buildExternalTopology(ObjectDef def, ExecutionContext context) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
Object topologySource = buildObject(def, context);
String methodName = context.getTopologyDef().getTopologySource().getMethodName();
Method getTopology = findGetTopologyMethod(topologySource, methodName);
if (getTopology.getParameterTypes()[0].equals(Config.class)) {
Config config = new Config();
config.putAll(context.getTopologyDef().getConfig());
return (StormTopology) getTopology.invoke(topologySource, config);
} else {
return (StormTopology) getTopology.invoke(topologySource, context.getTopologyDef().getConfig());
}
}
use of backtype.storm.Config in project jstorm by alibaba.
the class FluxBuilder method buildConfig.
/**
* Given a topology definition, return a populated `org.apache.storm.Config` instance.
*
* @param topologyDef
* @return
*/
public static Config buildConfig(TopologyDef topologyDef) {
// merge contents of `config` into topology config
Config conf = new Config();
conf.putAll(topologyDef.getConfig());
return conf;
}
use of backtype.storm.Config in project jstorm by alibaba.
the class TestTridentTopology method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.err.println("Please input configuration file");
System.exit(-1);
}
Map conf = LoadConfig.LoadConf(args[0]);
if (conf == null) {
LOG.error("Failed to load config");
} else {
Config config = new Config();
config.putAll(conf);
config.setMaxSpoutPending(10);
config.put(LoadConfig.TOPOLOGY_TYPE, "Trident");
StormSubmitter.submitTopology("WordCount", config, buildTopology());
}
}
use of backtype.storm.Config in project storm-signals by ptgoetz.
the class SignalTopology method main.
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("signal-spout", new TestSignalSpout("test-signal-spout"));
Config conf = new Config();
conf.setDebug(true);
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("test", conf, builder.createTopology());
Utils.sleep(120000);
cluster.killTopology("test");
cluster.shutdown();
}
use of backtype.storm.Config in project avro-kafka-storm by ransilberman.
the class AvroTopology method main.
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
//Add those lines to prevent too much logging noise in the console
Logger.getLogger("storm.kafka.PartitionManager").setLevel(Level.ERROR);
Logger.getLogger("backtype.storm").setLevel(Level.ERROR);
Logger.getLogger("storm.kafka").setLevel(Level.ERROR);
TopologyBuilder builder = new TopologyBuilder();
int partitions = 1;
final String offsetPath = "/liveperson-avro-test";
final String consumerId = "v1";
final String topic = "avro-test";
List<String> hosts = new ArrayList<String>();
hosts.add("tlvwhale1");
hosts.add("tlvwhale2");
hosts.add("tlvwhale3");
SpoutConfig kafkaConfig = new SpoutConfig(KafkaConfig.StaticHosts.fromHostString(hosts, partitions), topic, offsetPath, consumerId);
KafkaSpout kafkaSpout = new KafkaSpout(kafkaConfig);
builder.setSpout("spout", kafkaSpout);
builder.setBolt("bolt", new AvroBolt()).shuffleGrouping("spout");
Config conf = new Config();
conf.setDebug(true);
if (args != null && args.length > 0) {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
} else {
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("avroTopology", conf, builder.createTopology());
Utils.sleep(100000);
cluster.killTopology("avroTopology");
cluster.shutdown();
}
}
Aggregations