pykafka.membershipprotocol¶
-
class
pykafka.membershipprotocol.
GroupMembershipProtocol
(protocol_type, protocol_name, metadata, decide_partitions)¶ Bases:
tuple
-
__getnewargs__
()¶ Return self as a plain tuple. Used by copy and pickle.
-
__getstate__
()¶ Exclude the OrderedDict from pickling
-
static
__new__
(_cls, protocol_type, protocol_name, metadata, decide_partitions)¶ Create new instance of GroupMembershipProtocol(protocol_type, protocol_name, metadata, decide_partitions)
-
__repr__
()¶ Return a nicely formatted representation string
-
_asdict
()¶ Return a new OrderedDict which maps field names to their values
-
classmethod
_make
(iterable, new=<built-in method __new__ of type object>, len=<built-in function len>)¶ Make a new GroupMembershipProtocol object from a sequence or iterable
-
_replace
(**kwds)¶ Return a new GroupMembershipProtocol object replacing specified fields with new values
-
decide_partitions
¶ Alias for field number 3
-
metadata
¶ Alias for field number 2
-
protocol_name
¶ Alias for field number 1
-
protocol_type
¶ Alias for field number 0
-
-
pykafka.membershipprotocol.
decide_partitions_range
(participants, partitions, consumer_id)¶ Decide which partitions belong to this consumer_id.
Uses the consumer rebalancing algorithm described here https://kafka.apache.org/documentation/#impl_consumerrebalance
It is very important that the participants array is sorted, since this algorithm runs on each consumer and indexes into the same array. The same array index operation must return the same result on each consumer.
Parameters: - participants (Iterable of bytes) – Sorted list of ids of all consumers in this consumer group.
- partitions (Iterable of
pykafka.partition.Partition
) – List of all partitions on the topic being consumed - consumer_id (bytes) – The ID of the consumer for which to generate a partition assignment.
-
pykafka.membershipprotocol.
decide_partitions_roundrobin
(participants, partitions, consumer_id)¶ Decide which partitions belong to this consumer_id.
Uses the “roundrobin” strategy described here https://kafka.apache.org/documentation/#oldconsumerconfigs
Parameters: - participants (Iterable of bytes) – Sorted list of ids of all consumers in this consumer group.
- partitions (Iterable of
pykafka.partition.Partition
) – List of all partitions on the topic being consumed - consumer_id (bytes) – The ID of the consumer for which to generate a partition assignment.