Github user srdo commented on a diff in the pull request:
https://github.com/apache/storm/pull/2588#discussion_r173631986
--- Diff:
external/storm-eventhubs/src/main/java/org/apache/storm/eventhubs/bolt/EventHubBoltConfig.java
---
@@ -17,95 +17,185 @@
*******************************************************************************/
package org.apache.storm.eventhubs.bolt;
-import com.microsoft.azure.servicebus.ConnectionStringBuilder;
-import org.apache.storm.eventhubs.spout.EventHubSpoutConfig;
-
import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
-import java.io.Serializable;
+import org.apache.storm.eventhubs.core.FieldConstants;
+import org.apache.storm.eventhubs.format.DefaultEventDataFormat;
+import org.apache.storm.eventhubs.format.IEventDataFormat;
+
+import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
-/*
+/**
* EventHubs bolt configurations
+ * <p>
+ * Partition mode: partitionMode=true, in this mode each bolt task will
write to
+ * a partition with the same id as that of the task index. For this mode,
the
+ * number of bolt tasks must match the number of partitions.
+ * <p>
+ * partitionMode=false, default setting. There is no affinity between bolt
tasks
+ * and partitions. Events are written to partitions as determined by the
+ * EventHub partitioning logic.
*
- * Partition mode:
- * With partitionMode=true you need to create the same number of tasks as
the number of
- * EventHubs partitions, and each bolt task will only send data to one
partition.
- * The partition ID is the task ID of the bolt.
- *
- * Event format:
- * The formatter to convert tuple to bytes for EventHubs.
- * if null, the default format is common delimited tuple fields.
+ * @see IEventDataFormat
*/
public class EventHubBoltConfig implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String connectionString;
- private final String entityPath;
- protected boolean partitionMode;
- protected IEventDataFormat dataFormat;
-
- public EventHubBoltConfig(String connectionString, String entityPath) {
- this(connectionString, entityPath, false, null);
- }
-
- public EventHubBoltConfig(String connectionString, String entityPath,
- boolean partitionMode) {
- this(connectionString, entityPath, partitionMode, null);
- }
-
- public EventHubBoltConfig(String userName, String password, String
namespace,
- String entityPath, boolean partitionMode) {
- this(userName, password, namespace,
- EventHubSpoutConfig.EH_SERVICE_FQDN_SUFFIX, entityPath,
partitionMode);
- }
-
- public EventHubBoltConfig(String connectionString, String entityPath,
- boolean partitionMode, IEventDataFormat dataFormat) {
- this.connectionString = connectionString;
- this.entityPath = entityPath;
- this.partitionMode = partitionMode;
- this.dataFormat = dataFormat;
- if(this.dataFormat == null) {
- this.dataFormat = new DefaultEventDataFormat();
+ private static final long serialVersionUID = 1L;
+
+ private String connectionString;
+ protected boolean partitionMode;
+ protected IEventDataFormat dataFormat;
+
--- End diff --
Nit: You might consider writing this class using the Builder pattern. I
think it could reduce the number of constructors a lot.
---