Skip to content

Commit

Permalink
Make client keepalive interval configurable on pulsar-client-kafka (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
masnnuller authored and merlimat committed Sep 6, 2019
1 parent f6af696 commit 0f40adc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class PulsarClientKafkaConfig {
public static final String CONCURRENT_LOOKUP_REQUESTS = "pulsar.concurrent.lookup.requests";
public static final String MAX_NUMBER_OF_REJECTED_REQUESTS_PER_CONNECTION = "pulsar.max.number.rejected.request.per.connection";

public static final String KEEPALIVE_INTERVAL_MS = "pulsar.keepalive.interval.ms";

public static ClientBuilder getClientBuilder(Properties properties) {
ClientBuilder clientBuilder = PulsarClient.builder();

Expand Down Expand Up @@ -112,6 +114,11 @@ public static ClientBuilder getClientBuilder(Properties properties) {
Integer.parseInt(properties.getProperty(MAX_NUMBER_OF_REJECTED_REQUESTS_PER_CONNECTION)));
}

if (properties.containsKey(KEEPALIVE_INTERVAL_MS)) {
clientBuilder.keepAliveInterval(Integer.parseInt(properties.getProperty(KEEPALIVE_INTERVAL_MS)),
TimeUnit.MILLISECONDS);
}

return clientBuilder;
}
}
1 change: 1 addition & 0 deletions site2/docs/adaptors-kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ You can configure Pulsar authentication provider directly from the Kafka propert
| [`pulsar.use.tcp.nodelay`](http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ClientConfiguration.html#setUseTcpNoDelay-boolean-) | `true` | TCP no-delay. |
| [`pulsar.concurrent.lookup.requests`](http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ClientConfiguration.html#setConcurrentLookupRequest-int-) | `50000` | The maximum number of concurrent topic lookups. |
| [`pulsar.max.number.rejected.request.per.connection`](http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ClientConfiguration.html#setMaxNumberOfRejectedRequestPerConnection-int-) | `50` | The threshold of errors to forcefully close a connection. |
| [`pulsar.keepalive.interval.ms`](http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ClientBuilder.html#keepAliveInterval-int-java.util.concurrent.TimeUnit-)| `30000` | Keep alive interval for each client-broker-connection. |


### Pulsar producer properties
Expand Down

0 comments on commit 0f40adc

Please sign in to comment.