本文整理了Java中backtype.storm.task.TopologyContext.getComponentCommon()
方法的一些代码示例,展示了TopologyContext.getComponentCommon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TopologyContext.getComponentCommon()
方法的具体详情如下:
包路径:backtype.storm.task.TopologyContext
类名称:TopologyContext
方法名:getComponentCommon
暂无
代码示例来源:origin: alibaba/mdrill
/**
* Gets the set of streams declared for the specified component.
*/
public Set<String> getComponentStreams(String componentId) {
return getComponentCommon(componentId).get_streams().keySet();
}
代码示例来源:origin: alibaba/mdrill
/**
* Gets the declared inputs to the specified component.
*
* @return A map from subscribed component/stream to the grouping subscribed with.
*/
public Map<GlobalStreamId, Grouping> getSources(String componentId) {
return getComponentCommon(componentId).get_inputs();
}
代码示例来源:origin: alibaba/jstorm
/**
* get component configuration
*/
@SuppressWarnings("unchecked")
public static Map component_conf(TopologyContext topology_context, String component_id) {
Map<Object, Object> componentConf = new HashMap<>();
String jconf = topology_context.getComponentCommon(component_id).get_json_conf();
if (jconf != null) {
componentConf = (Map<Object, Object>) JStormUtils.from_json(jconf);
}
return componentConf;
}
代码示例来源:origin: alibaba/mdrill
/**
* Gets the declared output fields for the specified component/stream.
*/
public Fields getComponentOutputFields(String componentId, String streamId) {
StreamInfo streamInfo = getComponentCommon(componentId).get_streams().get(streamId);
if(streamInfo==null) {
throw new IllegalArgumentException("No output fields defined for component:stream " + componentId + ":" + streamId);
}
return new Fields(streamInfo.get_output_fields());
}
代码示例来源:origin: alibaba/mdrill
/**
* ȡcomponentӦϢ
* @param storm_conf
* @param topology_context
* @param component_id
* @return
*/
@SuppressWarnings("unchecked")
public static Map component_conf(Map storm_conf,
TopologyContext topology_context, String component_id) {
List<Object> to_remove = StormConfig.All_CONFIGS();
to_remove.remove(Config.TOPOLOGY_DEBUG);
to_remove.remove(Config.TOPOLOGY_MAX_SPOUT_PENDING);
to_remove.remove(Config.TOPOLOGY_MAX_TASK_PARALLELISM);
to_remove.remove(Config.TOPOLOGY_TRANSACTIONAL_ID);
Map<Object,Object> spec_conf = new HashMap<Object,Object>();
String jconf = topology_context.getComponentCommon(component_id)
.get_json_conf();
if (jconf != null) {
spec_conf = (Map<Object,Object>) StormUtils.from_json(jconf);
}
for (Object p : to_remove) {
spec_conf.remove(p);
}
spec_conf.putAll(storm_conf);
return spec_conf;
}
代码示例来源:origin: alibaba/mdrill
/**
* Gets information about who is consuming the outputs of the specified component,
* and how.
*
* @return Map from stream id to component id to the Grouping used.
*/
public Map<String, Map<String, Grouping>> getTargets(String componentId) {
Map<String, Map<String, Grouping>> ret = new HashMap<String, Map<String, Grouping>>();
for(String otherComponentId: getComponentIds()) {
Map<GlobalStreamId, Grouping> inputs = getComponentCommon(otherComponentId).get_inputs();
for(GlobalStreamId id: inputs.keySet()) {
if(id.get_componentId().equals(componentId)) {
Map<String, Grouping> curr = ret.get(id.get_streamId());
if(curr==null) curr = new HashMap<String, Grouping>();
curr.put(otherComponentId, inputs.get(id));
ret.put(id.get_streamId(), curr);
}
}
}
return ret;
}
代码示例来源:origin: alibaba/mdrill
public int maxTopologyMessageTimeout(Map<String, Object> topologyConfig) {
Integer max = Utils.getInt(topologyConfig.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
for(String spout: getRawTopology().get_spouts().keySet()) {
ComponentCommon common = getComponentCommon(spout);
String jsonConf = common.get_json_conf();
if(jsonConf!=null) {
Map conf = (Map) JSONValue.parse(jsonConf);
Object comp = conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS);
if(comp!=null) {
max = Math.max(Utils.getInt(comp), max);
}
}
}
return max;
}
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
/**
* get component configuration
*/
@SuppressWarnings("unchecked")
public static Map component_conf(Map storm_conf, TopologyContext topology_context, String component_id) {
List<Object> to_remove = StormConfig.All_CONFIGS();
to_remove.remove(Config.TOPOLOGY_DEBUG);
to_remove.remove(Config.TOPOLOGY_MAX_SPOUT_PENDING);
to_remove.remove(Config.TOPOLOGY_MAX_TASK_PARALLELISM);
to_remove.remove(Config.TOPOLOGY_TRANSACTIONAL_ID);
Map<Object, Object> componentConf = new HashMap<Object, Object>();
String jconf = topology_context.getComponentCommon(component_id).get_json_conf();
if (jconf != null) {
componentConf = (Map<Object, Object>) JStormUtils.from_json(jconf);
}
/**
* @@@ Don't know why need remove system configuration from component conf? //
*/
// for (Object p : to_remove) {
// componentConf.remove(p);
// }
Map<Object, Object> ret = new HashMap<Object, Object>();
ret.putAll(storm_conf);
ret.putAll(componentConf);
return ret;
}
内容来源于网络,如有侵权,请联系作者删除!