2727
2828class ConsumerCoordinator (BaseCoordinator ):
2929 """This class manages the coordination process with the consumer coordinator."""
30- DEFAULT_CONFIG = {
31- 'group_id' : 'kafka-python-default-group' ,
32- 'group_instance_id' : None ,
30+ DEFAULT_CONFIG = BaseCoordinator .DEFAULT_CONFIG .copy ()
31+ DEFAULT_CONFIG .update ({
3332 'enable_auto_commit' : True ,
3433 'auto_commit_interval_ms' : 5000 ,
3534 'default_offset_commit_callback' : None ,
3635 'assignors' : (RangePartitionAssignor , RoundRobinPartitionAssignor , StickyPartitionAssignor ),
37- 'session_timeout_ms' : 10000 ,
38- 'heartbeat_interval_ms' : 3000 ,
39- 'max_poll_interval_ms' : 300000 ,
40- 'request_timeout_ms' : 30000 ,
41- 'retry_backoff_ms' : 100 ,
42- 'api_version' : (0 , 10 , 1 ),
4336 'exclude_internal_topics' : True ,
4437 'isolation_level' : 'read_uncommitted' ,
45- 'metrics' : None ,
4638 'metric_group_prefix' : 'consumer'
47- }
39+ })
4840
4941 def __init__ (self , client , subscription , ** configs ):
5042 """Initialize the coordination manager.
@@ -53,14 +45,6 @@ def __init__(self, client, subscription, **configs):
5345 group_id (str): name of the consumer group to join for dynamic
5446 partition assignment (if enabled), and to use for fetching and
5547 committing offsets. Default: 'kafka-python-default-group'
56- group_instance_id (str): A unique identifier of the consumer instance
57- provided by end user. Only non-empty strings are permitted. If set,
58- the consumer is treated as a static member, which means that only
59- one instance with this ID is allowed in the consumer group at any
60- time. This can be used in combination with a larger session timeout
61- to avoid group rebalances caused by transient unavailability (e.g.
62- process restarts). If not set, the consumer will join the group as
63- a dynamic member, which is the traditional behavior. Default: None
6448 enable_auto_commit (bool): If true the consumer's offset will be
6549 periodically committed in the background. Default: True.
6650 auto_commit_interval_ms (int): milliseconds between automatic
@@ -72,17 +56,6 @@ def __init__(self, client, subscription, **configs):
7256 assignors (list): List of objects to use to distribute partition
7357 ownership amongst consumer instances when group management is
7458 used. Default: [RangePartitionAssignor, RoundRobinPartitionAssignor, StickyPartitionAssignor]
75- heartbeat_interval_ms (int): The expected time in milliseconds
76- between heartbeats to the consumer coordinator when using
77- Kafka's group management feature. Heartbeats are used to ensure
78- that the consumer's session stays active and to facilitate
79- rebalancing when new consumers join or leave the group. The
80- value must be set lower than session_timeout_ms, but typically
81- should be set no higher than 1/3 of that value. It can be
82- adjusted even lower to control the expected time for normal
83- rebalances. Default: 3000
84- session_timeout_ms (int): The timeout used to detect failures when
85- using Kafka's group management facilities. Default: 30000
8659 retry_backoff_ms (int): Milliseconds to backoff when retrying on
8760 errors. Default: 100.
8861 exclude_internal_topics (bool): Whether records from internal topics
@@ -121,11 +94,6 @@ def __init__(self, client, subscription, **configs):
12194 if self ._use_group_apis :
12295 if not self .config ['assignors' ]:
12396 raise Errors .KafkaConfigurationError ('Coordinator requires assignors' )
124- if self .config ['api_version' ] < (0 , 10 , 1 ):
125- if self .config ['max_poll_interval_ms' ] != self .config ['session_timeout_ms' ]:
126- raise Errors .KafkaConfigurationError ("Broker version %s does not support "
127- "different values for max_poll_interval_ms "
128- "and session_timeout_ms" )
12997
13098 if self .config ['enable_auto_commit' ]:
13199 if not self ._use_offset_apis :
@@ -264,7 +232,7 @@ def _lookup_assignor(self, name):
264232 # warning. Sync listeners on the IO loop will block heartbeats while
265233 # they run; even async ones delay rebalance progress. 1s is a soft
266234 # ceiling: well below default heartbeat_interval_ms (3s) and
267- # session_timeout_ms (10s ).
235+ # session_timeout_ms (45s ).
268236 _REBALANCE_LISTENER_WARN_SECS = 1.0
269237
270238 async def _invoke_rebalance_listener_async (self , method_name , arg ):
0 commit comments