Github user srdo commented on a diff in the pull request: https://github.com/apache/storm/pull/2588#discussion_r173631909 --- 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; + + /** + * Constructs an instance with specified connection string, and eventhub name + * The @link {@link #partitionMode} is set to false. + * + * @param connectionString EventHub connection string + * @param entityPath EventHub name + */ + public EventHubBoltConfig(final String connectionString, final String entityPath) { + this(connectionString, entityPath, false, null); + } + + /** + * Constructs an instance with specified connection string, eventhub name and + * partition mode. + * + * @param connectionString EventHub connection string + * @param entityPath EventHub name + * @param partitionMode partitionMode to apply + */ + public EventHubBoltConfig(String connectionString, String entityPath, boolean partitionMode) { + this(connectionString, entityPath, partitionMode, null); + } + + /** + * Constructs an instance with specified credentials, eventhub name and + * partition mode. + * <p> + * <p> + * For soverign clouds please use the constructor + * {@link EventHubBolt#EventHubBolt(String, String)}. + * </p> + * + * @param userName user name to connect as + * @param password password for the user name + * @param namespace servicebus namespace + * @param entityPath EntityHub name + * @param partitionMode Dictates write mode. if true will write to specific partitions + */ + public EventHubBoltConfig(String userName, String password, String namespace, String entityPath, + boolean partitionMode) { + this(userName, password, namespace, FieldConstants.EH_SERVICE_FQDN_SUFFIX, entityPath, partitionMode); + } + + /** + * Constructs an instance with specified connection string, and partition mode. + * The specified {@link IEventDataFormat} will be used to format data to bytes + * before --- End diff -- This seems incomplete
---