Jic*_*aar 1 java user-interface apache-flink
我的目标是通过群集GUI中的“程序参数”字段将args传递给Flink作业的Main()函数。
并以某种方式在Main()函数中访问它们(最好是通过键名):
public static void main(String[] args) throws Exception {
ParameterTool parameter = ParameterTool.fromArgs(args);
CustomProps props = new CustomProps (DEFAULT_PROPERTIES_FILE);
String kafkaAutoOffsetReset = props.getKafkaAutoOffsetReset();
String cassandraClusterUrl = props.getCassandraClusterUrl();
if (args.length == 1 && args[0] != null) {
cassandraClusterUrl = parameter.get("cassandraClusterUrl");
kafkaAutoOffsetReset = parameter.get("kafkaOffset");
}
//Other code...
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过“ ParameterTool”,但没有任何帮助,如果尝试以下操作:
kafkaAutoOffsetReset = args[0];
Run Code Online (Sandbox Code Playgroud)
仅当我在“程序参数”字段中仅输入一个单词时,它才有效。所以,如果我把:
blah
Run Code Online (Sandbox Code Playgroud)
它说它设置为“等等”,但是如果我尝试以下任何一种方法:
-kafkaOffset blah
--kafkaOffset blah
-kafkaOffset:blah
-kafkaOffset=blah
Run Code Online (Sandbox Code Playgroud)
我什么都没有。我知道在CLI中,如何将args传递给jar的示例是:
--input file:///home/user/hamlet.txt --output file:///home/user/wordcount_out
Run Code Online (Sandbox Code Playgroud)
但是,似乎缺少使用GUI的另一种方式,但是我未能找到与此相关的文档。
TL; DR
通过Flink群集GUI中的“程序参数”字段提交多个arg的正确方法是什么,以及在Main()函数中访问它们的正确方法是什么?
感谢您提前提供的所有帮助!
| 归档时间: |
|
| 查看次数: |
2154 次 |
| 最近记录: |