Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#748 - Allow config consumer.max.poll.records #750

Open
wants to merge 1 commit into
base: 5.5.1-post
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class KafkaRestConfig extends RestConfig {
private static final String MAX_POLL_RECORDS_DOC =
"The maximum number of records returned in a single call to poll().";
// ensures poll is frequently needed and called
public static final String MAX_POLL_RECORDS_VALUE = "30";
public static final String MAX_POLL_RECORDS_DEFAULT = "30";

public static final String HOST_NAME_CONFIG = "host.name";
private static final String HOST_NAME_DOC =
Expand Down Expand Up @@ -371,6 +371,13 @@ protected static ConfigDef baseKafkaRestConfigDef() {
Importance.MEDIUM,
CONSUMER_MAX_THREADS_DOC
)
.define(
MAX_POLL_RECORDS_CONFIG,
Type.INT,
MAX_POLL_RECORDS_DEFAULT,
Importance.MEDIUM,
MAX_POLL_RECORDS_DOC
)
.define(
ZOOKEEPER_CONNECT_CONFIG,
Type.STRING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import static io.confluent.kafkarest.KafkaRestConfig.CONSUMER_MAX_THREADS_CONFIG;
import static io.confluent.kafkarest.KafkaRestConfig.MAX_POLL_RECORDS_CONFIG;
import static io.confluent.kafkarest.KafkaRestConfig.MAX_POLL_RECORDS_VALUE;

import io.confluent.kafkarest.ConsumerInstanceId;
import io.confluent.kafkarest.ConsumerReadCallback;
Expand Down Expand Up @@ -201,7 +200,10 @@ public String createConsumer(String group, ConsumerInstanceConfig instanceConfig
//Properties props = (Properties) config.getOriginalProperties().clone();
Properties props = config.getConsumerProperties();
props.setProperty(KafkaRestConfig.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers);
props.setProperty(MAX_POLL_RECORDS_CONFIG, MAX_POLL_RECORDS_VALUE);
if (props.getProperty(MAX_POLL_RECORDS_CONFIG) == null) {
props.setProperty(MAX_POLL_RECORDS_CONFIG,
config.getInt(MAX_POLL_RECORDS_CONFIG).toString());
}
props.setProperty("group.id", group);
// This ID we pass here has to be unique, only pass a value along if the deprecated ID field
// was passed in. This generally shouldn't be used, but is maintained for compatibility.
Expand Down