use of org.apache.storm.generated.StormTopology in project storm by apache.
the class FluxBuilder method buildExternalTopology.
private static StormTopology buildExternalTopology(ObjectDef def, ExecutionContext context) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException, NoSuchFieldException {
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 org.apache.storm.generated.StormTopology in project storm by apache.
the class TridentMinMaxOfDevicesTopology method main.
public static void main(String[] args) throws Exception {
StormTopology topology = buildDevicesTopology();
Config conf = new Config();
conf.setMaxSpoutPending(20);
if (args.length == 0) {
try (LocalCluster cluster = new LocalCluster();
LocalTopology topo = cluster.submitTopology("devices-topology", conf, topology)) {
Utils.sleep(60 * 1000);
}
System.exit(0);
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar("devices-topology", conf, topology);
}
}
use of org.apache.storm.generated.StormTopology in project storm by apache.
the class TCKTest method testTopologySourceWithGetMethodName.
@Test
public void testTopologySourceWithGetMethodName() throws Exception {
TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-reflection.yaml", false, true, null, false);
assertTrue(topologyDef.validate());
Config conf = FluxBuilder.buildConfig(topologyDef);
ExecutionContext context = new ExecutionContext(topologyDef, conf);
StormTopology topology = FluxBuilder.buildTopology(context);
assertNotNull(topology);
topology.validate();
}
use of org.apache.storm.generated.StormTopology in project storm by apache.
the class TCKTest method testTopologySourceWithMethodName.
@Test
public void testTopologySourceWithMethodName() throws Exception {
TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-method-override.yaml", false, true, null, false);
assertTrue(topologyDef.validate());
Config conf = FluxBuilder.buildConfig(topologyDef);
ExecutionContext context = new ExecutionContext(topologyDef, conf);
StormTopology topology = FluxBuilder.buildTopology(context);
assertNotNull(topology);
topology.validate();
}
use of org.apache.storm.generated.StormTopology in project storm by apache.
the class TCKTest method testTopologySourceWithReflection.
@Test
public void testTopologySourceWithReflection() throws Exception {
TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-reflection.yaml", false, true, null, false);
assertTrue(topologyDef.validate());
Config conf = FluxBuilder.buildConfig(topologyDef);
ExecutionContext context = new ExecutionContext(topologyDef, conf);
StormTopology topology = FluxBuilder.buildTopology(context);
assertNotNull(topology);
topology.validate();
}
Aggregations