本文整理汇总了Java中org.apache.storm.generated.Bolt类的典型用法代码示例。如果您正苦于以下问题:Java Bolt类的具体用法?Java Bolt怎么用?Java Bolt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Bolt类属于org.apache.storm.generated包,在下文中一共展示了Bolt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTerminalUserBoltNames
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
public static Set<String> getTerminalUserBoltNames(StormTopology topology) {
Set<String> terminalBolts = new HashSet<>();
Set<String> inputs = new HashSet<>();
for (Map.Entry<String, Bolt> entry : topology.get_bolts().entrySet()) {
String name = entry.getKey();
Set<GlobalStreamId> inputsForBolt = entry.getValue().get_common().get_inputs().keySet();
if (!isSystemComponent(name)) {
for (GlobalStreamId streamId : inputsForBolt) {
inputs.add(streamId.get_componentId());
}
}
}
for (String boltName : topology.get_bolts().keySet()) {
if (!isSystemComponent(boltName) && !inputs.contains(boltName)) {
terminalBolts.add(boltName);
}
}
return terminalBolts;
}
示例2: getAdjacencyMap
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
public static Map<String, Set<String>> getAdjacencyMap(StormTopology topology,
boolean removeSystemComponent)
throws Exception {
Map<String, Set<String>> adjacencyMap = new HashMap<>();
for (Map.Entry<String, Bolt> entry : topology.get_bolts().entrySet()) {
String boltName = entry.getKey();
Map<GlobalStreamId, Grouping> inputs = entry.getValue().get_common().get_inputs();
for (Map.Entry<GlobalStreamId, Grouping> input : inputs.entrySet()) {
String inputComponentId = input.getKey().get_componentId();
Set<String> components = adjacencyMap.containsKey(inputComponentId)
? adjacencyMap.get(inputComponentId) : new HashSet<String>();
components.add(boltName);
components = removeSystemComponent ? removeSystemComponents(components)
: components;
if (!removeSystemComponent || !isSystemComponent(inputComponentId)) {
adjacencyMap.put(inputComponentId, components);
}
}
}
return adjacencyMap;
}
示例3: addTopologyOutputs
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
private void addTopologyOutputs(Referenceable topologyReferenceable,
StormTopology stormTopology, String topologyOwner,
Map stormConf, List<Referenceable> dependentEntities) throws Exception {
final ArrayList<Referenceable> outputDataSets = new ArrayList<>();
Map<String, Bolt> bolts = stormTopology.get_bolts();
Set<String> terminalBoltNames = StormTopologyUtil.getTerminalUserBoltNames(stormTopology);
for (String terminalBoltName : terminalBoltNames) {
Serializable instance = Utils.javaDeserialize(bolts.get(terminalBoltName)
.get_bolt_object().get_serialized_java(), Serializable.class);
String dataSetType = instance.getClass().getSimpleName();
final Referenceable datasetRef = createDataSet(dataSetType, topologyOwner, instance, stormConf, dependentEntities);
if (datasetRef != null) {
outputDataSets.add(datasetRef);
}
}
topologyReferenceable.set("outputs", outputDataSets);
}
示例4: getRawTopology
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
/**
* Gets the Thrift object representing the topology.
*
* @return the Thrift definition representing the topology
*/
@SuppressWarnings("deprecation")
public StormTopology getRawTopology() {
StormTopology stormTopology = new StormTopology();
Map<String, SpoutSpec> spouts = new HashMap<>();
for (TopologyAPI.Spout spout : this.delegate.getRawTopology().getSpoutsList()) {
spouts.put(spout.getComp().getName(), new SpoutSpec(spout));
}
Map<String, Bolt> bolts = new HashMap<>();
for (TopologyAPI.Bolt bolt : this.delegate.getRawTopology().getBoltsList()) {
bolts.put(bolt.getComp().getName(), new Bolt(bolt));
}
stormTopology.set_spouts(spouts);
stormTopology.set_bolts(bolts);
return stormTopology;
}
示例5: testAddTaskHook
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testAddTaskHook() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.addTaskHook(null);
}
示例6: testGetHooks
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testGetHooks() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.getHooks();
}
示例7: testRegisteredMetric1
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test(expected = UnsupportedOperationException.class)
public void testRegisteredMetric1() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.registerMetric(null, (ICombiner) null, 0);
}
示例8: testRegisteredMetric2
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test(expected = UnsupportedOperationException.class)
public void testRegisteredMetric2() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.registerMetric(null, (IReducer) null, 0);
}
示例9: testRegisteredMetric3
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testRegisteredMetric3() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.registerMetric(null, (IMetric) null, 0);
}
示例10: testGetRegisteredMetricByName
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testGetRegisteredMetricByName() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.getRegisteredMetricByName(null);
}
示例11: testSetAllSubscribedState
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testSetAllSubscribedState() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.setAllSubscribedState(null);
}
示例12: testSetSubscribedState1
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testSetSubscribedState1() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.setSubscribedState(null, null);
}
示例13: testSetSubscribedState2
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testSetSubscribedState2() {
new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null)
.setSubscribedState(null, null, null);
}
示例14: createTopologyGraph
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
private ArrayList<Referenceable> createTopologyGraph(StormTopology stormTopology,
Map<String, SpoutSpec> spouts,
Map<String, Bolt> bolts) throws Exception {
// Add graph of nodes in the topology
final Map<String, Referenceable> nodeEntities = new HashMap<>();
addSpouts(spouts, nodeEntities);
addBolts(bolts, nodeEntities);
addGraphConnections(stormTopology, nodeEntities);
ArrayList<Referenceable> nodes = new ArrayList<>();
nodes.addAll(nodeEntities.values());
return nodes;
}
示例15: addBolts
import org.apache.storm.generated.Bolt; //导入依赖的package包/类
private void addBolts(Map<String, Bolt> bolts,
Map<String, Referenceable> nodeEntities) throws IllegalAccessException {
for (Map.Entry<String, Bolt> entry : bolts.entrySet()) {
Referenceable boltInstance = createBoltInstance(entry.getKey(), entry.getValue());
nodeEntities.put(entry.getKey(), boltInstance);
}
}