Java Code Examples for backtype.storm.utils.Utils#getComponentCommon()

The following examples show how to use backtype.storm.utils.Utils#getComponentCommon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransactionCommon.java    From jstorm with Apache License 2.0 5 votes vote down vote up
public static Set<String> getUpstreamComponents(String componentId, TopologyContext context) {
    Set<String> upstreamComponents = new HashSet<>();
    ComponentCommon componentCommon = Utils.getComponentCommon(context.getRawTopology(), componentId);
    Set<GlobalStreamId> input = componentCommon.get_inputs().keySet();
    for (GlobalStreamId stream : input) {
        upstreamComponents.add(stream.get_componentId());
    }
    return upstreamComponents;
}
 
Example 2
Source File: TransactionCommon.java    From jstorm with Apache License 2.0 5 votes vote down vote up
private static boolean hasDownstreamComponent(StormTopology topology, String outComponentId, String outStreamId) {
    boolean ret = false;
    for (String componentId : ThriftTopologyUtils.getComponentIds(topology)) {
        ComponentCommon componentCommon = Utils.getComponentCommon(topology, componentId);
        Set<GlobalStreamId> inputs = componentCommon.get_inputs().keySet();
        for (GlobalStreamId input : inputs) {
            if (input.get_componentId().equals(outComponentId) && input.get_streamId().equals(outStreamId))
                return true;
        }
    }
    return ret;
}
 
Example 3
Source File: SerializationFactory.java    From jstorm with Apache License 2.0 5 votes vote down vote up
public IdDictionary(StormTopology topology) {
    List<String> componentNames = new ArrayList<>(topology.get_spouts().keySet());
    componentNames.addAll(topology.get_bolts().keySet());
    componentNames.addAll(topology.get_state_spouts().keySet());

    for (String name : componentNames) {
        ComponentCommon common = Utils.getComponentCommon(topology, name);
        List<String> streams = new ArrayList<>(common.get_streams().keySet());
        streamNametoId.put(name, idify(streams));
        streamIdToName.put(name, Utils.reverseMap(streamNametoId.get(name)));
    }
}