Skip to content

Commit

Permalink
MINOR: Add error message to setMaxPendingMessagesAcrossPartitions (ap…
Browse files Browse the repository at this point in the history
…ache#10709)

### Motivation
When maxPendingMessagesAcrossPartitions is less than maxPendingMessages, an error message will be thrown: null

### Modifications
return "maxPendingMessagesAcrossPartitions needs to be >= maxPendingMessages" instead
  • Loading branch information
wenbingshen authored May 27, 2021
1 parent 894d92b commit 2cfed8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public void setMaxPendingMessages(int maxPendingMessages) {
}

public void setMaxPendingMessagesAcrossPartitions(int maxPendingMessagesAcrossPartitions) {
checkArgument(maxPendingMessagesAcrossPartitions >= maxPendingMessages);
checkArgument(maxPendingMessagesAcrossPartitions >= maxPendingMessages,
"maxPendingMessagesAcrossPartitions needs to be >= maxPendingMessages");
this.maxPendingMessagesAcrossPartitions = maxPendingMessagesAcrossPartitions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ public void testProducerBuilderImplWhenMaxPendingMessagesAcrossPartitionsPropert
producerBuilderImpl.maxPendingMessagesAcrossPartitions(999);
}

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "maxPendingMessagesAcrossPartitions needs to be >= maxPendingMessages")
public void testProducerBuilderImplWhenMaxPendingMessagesAcrossPartitionsPropertyIsInvalidErrorMessages() {
producerBuilderImpl.maxPendingMessagesAcrossPartitions(999);
}

@Test
public void testProducerBuilderImplWhenNumericPropertiesAreValid() {
producerBuilderImpl.batchingMaxPublishDelay(1, TimeUnit.SECONDS);
Expand Down

0 comments on commit 2cfed8c

Please sign in to comment.