本文整理了Java中org.apache.storm.utils.Utils.getTopologyInfo()
方法的一些代码示例,展示了Utils.getTopologyInfo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getTopologyInfo()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:getTopologyInfo
暂无
代码示例来源:origin: apache/storm
/**
* @param name
* @param asUser
* @param topoConf
* @param topology
* @thorws SubmitterHookException This is thrown when any Exception occurs during initialization or invocation of registered {@link
* ISubmitterHook}
*/
private static void invokeSubmitterHook(String name, String asUser, Map<String, Object> topoConf, StormTopology topology) {
String submissionNotifierClassName = null;
try {
if (topoConf.containsKey(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN)) {
submissionNotifierClassName = topoConf.get(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN).toString();
LOG.info("Initializing the registered ISubmitterHook [{}]", submissionNotifierClassName);
if (submissionNotifierClassName == null || submissionNotifierClassName.isEmpty()) {
throw new IllegalArgumentException(
Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN + " property must be a non empty string.");
}
ISubmitterHook submitterHook = (ISubmitterHook) Class.forName(submissionNotifierClassName).newInstance();
TopologyInfo topologyInfo = Utils.getTopologyInfo(name, asUser, topoConf);
LOG.info("Invoking the registered ISubmitterHook [{}]", submissionNotifierClassName);
submitterHook.notify(topologyInfo, topoConf, topology);
}
} catch (Exception e) {
LOG.warn("Error occurred in invoking submitter hook:[{}] ", submissionNotifierClassName, e);
throw new SubmitterHookException(e);
}
}
代码示例来源:origin: apache/storm
@Override
public LocalTopology submitTopology(String topologyName, Map<String, Object> conf, StormTopology topology)
throws TException {
if (!Utils.isValidConf(conf)) {
throw new IllegalArgumentException("Topology conf is not json-serializable");
}
getNimbus().submitTopology(topologyName, null, JSONValue.toJSONString(conf), Utils.addVersions(topology));
ISubmitterHook hook = (ISubmitterHook) Utils.getConfiguredClass(conf, Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN);
if (hook != null) {
TopologyInfo topologyInfo = Utils.getTopologyInfo(topologyName, null, conf);
try {
hook.notify(topologyInfo, conf, topology);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
return new LocalTopology(topologyName, topology);
}
代码示例来源:origin: org.apache.storm/storm-core
/**
*
* @param name
* @param asUser
* @param stormConf
* @param topology
*
* @thorws SubmitterHookException This is thrown when any Exception occurs during initialization or invocation of registered {@link ISubmitterHook}
*/
private static void invokeSubmitterHook(String name, String asUser, Map stormConf, StormTopology topology) {
String submissionNotifierClassName = null;
try {
if (stormConf.containsKey(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN)) {
submissionNotifierClassName = stormConf.get(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN).toString();
LOG.info("Initializing the registered ISubmitterHook [{}]", submissionNotifierClassName);
if(submissionNotifierClassName == null || submissionNotifierClassName.isEmpty()) {
throw new IllegalArgumentException(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN + " property must be a non empty string.");
}
ISubmitterHook submitterHook = (ISubmitterHook) Class.forName(submissionNotifierClassName).newInstance();
TopologyInfo topologyInfo = Utils.getTopologyInfo(name, asUser, stormConf);
LOG.info("Invoking the registered ISubmitterHook [{}]", submissionNotifierClassName);
submitterHook.notify(topologyInfo, stormConf, topology);
}
} catch (Exception e) {
LOG.warn("Error occurred in invoking submitter hook:[{}] ",submissionNotifierClassName, e);
throw new SubmitterHookException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!