private int maxRecoveryQueueSize;
- private DMaaPMRPublisherConfig(@Nonnull String hostName,
- @Nonnull Integer portNumber,
- @Nonnull String topicName,
- @Nonnull String protocol,
- String userName,
- String userPassword,
- @Nonnull String contentType,
- int maxBatchSize,
- int maxRecoveryQueueSize) {
- this.hostName = hostName;
- this.portNumber = portNumber;
- this.topicName = topicName;
- this.protocol = protocol;
- this.userName = userName;
- this.userPassword = userPassword;
- this.contentType = contentType;
- this.maxBatchSize = maxBatchSize;
- this.maxRecoveryQueueSize = maxRecoveryQueueSize;
+ private DMaaPMRPublisherConfig(Builder builder) {
+ this.hostName = builder.hostName;
+ this.portNumber = builder.portNumber;
+ this.topicName = builder.topicName;
+ this.protocol = builder.protocol;
+ this.userName = builder.userName;
+ this.userPassword = builder.userPassword;
+ this.contentType = builder.contentType;
+ this.maxBatchSize = builder.maxBatchSize;
+ this.maxRecoveryQueueSize = builder.maxRecoveryQueueSize;
}
* @return Builds and returns thread safe, immutable {@link DMaaPMRPublisherConfig} object
*/
public DMaaPMRPublisherConfig build() {
- return new DMaaPMRPublisherConfig(hostName, portNumber, topicName, protocol, userName, userPassword,
- contentType, maxBatchSize, maxRecoveryQueueSize);
+ return new DMaaPMRPublisherConfig(this);
}
}