lamber-ken commented on issue #7387: [FLINK-11235] fix thread lack when elasticsearch transport client init failed URL: https://github.com/apache/flink/pull/7387#issuecomment-450656267 here is a reproducible example ``` StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.enableCheckpointing(5000L); // env.setRestartStrategy(RestartStrategies.fixedDelayRestart(10000, 600L)); DataStreamSource<String> source = env.addSource(new SourceFunction<String>() { @Override public void run(SourceContext<String> ctx) throws Exception { for (int i = 0; i < 100000000; i++) { Thread.sleep(1000); ctx.collect("data " + i); } } @Override public void cancel() { } }); Map<String, String> config = new HashMap<>(); config.put("cluster.name", "elasticsearch"); config.put("bulk.flush.max.actions", "3"); List<InetSocketAddress> transportAddresses = new ArrayList<>(); transportAddresses.add(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 9700)); ElasticsearchSink<String> essink = new ElasticsearchSink<>(config, transportAddresses, new ElasticsearchSinkFunction<String>() { @Override public void process(String element, RuntimeContext ctx, RequestIndexer indexer) { HashMap<String, String> data = Maps.newHashMap(); data.put("key", element); indexer.add(Requests.indexRequest().index("index").type("type").source(data)); } }); source.addSink(essink); env.execute(); ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
