Github user srdo commented on a diff in the pull request:
https://github.com/apache/storm/pull/2596#discussion_r176907985
--- Diff:
examples/storm-elasticsearch-examples/src/main/java/org/apache/storm/elasticsearch/bolt/EsIndexTopology.java
---
@@ -34,52 +39,128 @@
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Values;
-public class EsIndexTopology {
+/**
+ * Demonstrates an ElasticSearch Strom topology.
+ * @author unknown
+ */
+public final class EsIndexTopology {
+ /**
+ * The id of the used spout.
+ */
static final String SPOUT_ID = "spout";
+ /**
+ * The id of the used bolt.
+ */
static final String BOLT_ID = "bolt";
+ /**
+ * The name of the used topology.
+ */
static final String TOPOLOGY_NAME = "elasticsearch-test-topology1";
+ /**
+ * The number of pending tuples triggering logging.
+ */
+ private static final int PENDING_COUNT_MAX = 1000;
- public static void main(String[] args) throws Exception {
+ /**
+ * The example's main method.
+ * @param args the command line arguments
+ * @throws AlreadyAliveException if the topology is already started
+ * @throws InvalidTopologyException if the topology is invalid
+ * @throws AuthorizationException if the topology authorization fails
+ */
+ public static void main(final String[] args) throws
AlreadyAliveException,
+ InvalidTopologyException,
+ AuthorizationException {
Config config = new Config();
config.setNumWorkers(1);
TopologyBuilder builder = new TopologyBuilder();
UserDataSpout spout = new UserDataSpout();
builder.setSpout(SPOUT_ID, spout, 1);
EsTupleMapper tupleMapper =
EsTestUtil.generateDefaultTupleMapper();
EsConfig esConfig = new EsConfig("http://localhost:9300");
- builder.setBolt(BOLT_ID, new EsIndexBolt(esConfig, tupleMapper),
1).shuffleGrouping(SPOUT_ID);
+ builder.setBolt(BOLT_ID, new EsIndexBolt(esConfig, tupleMapper), 1)
+ .shuffleGrouping(SPOUT_ID);
EsTestUtil.startEsNode();
- EsTestUtil.waitForSeconds(5);
- StormSubmitter.submitTopology(TOPOLOGY_NAME, config,
builder.createTopology());
+ EsTestUtil.waitForSeconds(EsConstants.WAIT_DEFAULT);
+ StormSubmitter.submitTopology(TOPOLOGY_NAME,
+ config,
+ builder.createTopology());
}
+ /**
+ * The user data spout.
+ */
public static class UserDataSpout extends BaseRichSpout {
+ private static final long serialVersionUID = 1L;
+ /**
+ * The pending values.
+ */
private ConcurrentHashMap<UUID, Values> pending;
+ /**
+ * The collector passed in
+ * {@link #open(java.util.Map,
org.apache.storm.task.TopologyContext,
+ * org.apache.storm.spout.SpoutOutputCollector) }.
+ */
private SpoutOutputCollector collector;
+ /**
+ * The sources.
+ */
private String[] sources = {
- "{\"user\":\"user1\"}",
- "{\"user\":\"user2\"}",
- "{\"user\":\"user3\"}",
- "{\"user\":\"user4\"}"
+ "{\"user\":\"user1\"}",
+ "{\"user\":\"user2\"}",
+ "{\"user\":\"user3\"}",
+ "{\"user\":\"user4\"}"
};
+ /**
--- End diff --
Is checkstyle requiring these comments? If not I'd rather we don't have
them. Comments that are just "The $variable_name" are just noise.
---