...
Is there a better way to configure session interval and heartbeat interval?
User-provided Timeouts
The Consumer
API provides a means for users to express that a given operation should be time-bound via optional timeout values.
Note | ||
---|---|---|
| ||
A precise definition of the timeout policy and behavior is, unfortunately, undefined. The main clues as to their interworking are based on the API-level documentation as well as the source code itself. The documentation can be a little vague and the source code is not consistent throughout the different APIs. Also, Kafka does not provide any real time guarantees, of course. So the level of precision in describing the timeouts is rough. This leaves us in the situation in which there may more than one way to interpret how a timeout is implemented. |
The approach taken is for users to provide a Duration
object as one of the API method parameters. Not all of the APIs allow users to provide a timeout, but of those that do, they are either required or optional. For example, the following Consumer
APIs require a timeout:
clientInstanceId
poll
On the other hand, the following APIs provide overloaded versions that allow the user to pass in an optional timeout:
beginningOffsets
close
commitSync
committed
endOffsets
listTopics
offsetsForTimes
partitionsFor
position
Compatibility
The new consumer should be backward compatible.
...