kiel.zookeeper.party
¶kiel.zookeeper.party.
Party
(client, member_name, path, on_change)[source]¶Bases: object
Represents a “party” recipe in Zookeeper.
A party is a recipe where various clients “join” or “leave” (a loss of connection constituting a “leave”) and each member is notified when membership changes.
This is used in the Zookeeper-based GroupedConsumer
in order to
determine who and how many hosts to divvy up partitions to.
start
()[source]¶Simple method that sets up the membership change callback.
Expected to be called by potential members before the join()
method.
join
()[source]¶Establishes the client as a “member” of the party.
This is done by creating an ephemeral child node of the party’s root path unique to this member. If the path of the child node exists but this client isn’t the owner, the node is re-created in a transaction to establish ownership.
Note
It is important that the child node is ephemeral so that lost connections are indistinguishable from “leaving” the party.