Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/573#discussion_r30113258
--- Diff:
flink-staging/flink-streaming/flink-storm-examples/src/main/java/org/apache/flink/stormcompatibility/wordcount/StormWordCountLocal.java
---
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.stormcompatibility.wordcount;
+
+import org.apache.flink.examples.java.wordcount.util.WordCountData;
+import org.apache.flink.stormcompatibility.api.FlinkLocalCluster;
+import org.apache.flink.stormcompatibility.api.FlinkTopologyBuilder;
+
+import backtype.storm.LocalCluster;
+import backtype.storm.generated.StormTopology;
+import backtype.storm.utils.Utils;
+
+
+
+
+
+/**
+ * Implements the "WordCount" program that computes a simple word
occurrence histogram over text files in a streaming
+ * fashion. The program is constructed as a regular {@link StormTopology}
and submitted to Flink for execution in the
+ * same way as to a Storm {@link LocalCluster}.
+ *
+ * This example shows how to run program directly within Java, thus it
cannot be used to submit a {@link StormTopology}
+ * via Flink command line clients (ie, bin/flink).
+ *
+ * <p>
+ * The input is a plain text file with lines separated by newline
characters.
+ *
+ * <p>
+ * Usage: <code>WordCount <text path> <result path></code><br>
+ * If no parameters are provided, the program is run with default data
from {@link WordCountData}.
+ *
+ * <p>
+ * This example shows how to:
+ * <ul>
+ * <li>run a regular Storm program locally on Flink
+ * </ul>
+ */
+public class StormWordCountLocal {
+ public final static String topologyId = "Streaming WordCount";
+
+ //
*************************************************************************
+ // PROGRAM
+ //
*************************************************************************
+
+ public static void main(final String[] args) throws Exception {
+
+ if(!WordCountTopology.parseParameters(args)) {
+ return;
+ }
+
+ // build Topology the Storm way
+ final FlinkTopologyBuilder builder =
WordCountTopology.buildTopology();
+
+ // execute program locally
+ final FlinkLocalCluster cluster =
FlinkLocalCluster.getLocalCluster();
+ cluster.submitTopology(topologyId, null,
builder.createTopology());
+
+ Utils.sleep(5 * 1000);
--- End diff --
Why is it necessary to sleep in the examples? Isn't there a way to submit
the topology in a blocking way?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---