GitHub user merlimat added a comment to the discussion: how use exclusive 
implements leader election ??i want know more details??

@startjava You can implement a "leader election" pattern using the "exclusive 
producer" feature. 

Basically, if a certain producer is able to become the "exclusive producer" on 
the topic, it will assume itself the role of "leader". It is important though 
that all the decisions taken by the leader to be communicated as messages 
published in the topic.

There are few options to chose from when creating the exclusive producer: 
 * `Exclusive`: Require exclusive access for producer. Gives error if there's 
already a producer
 * `ExclusiveWithFencing`: Acquire exclusive access for the producer. - Removes 
any existing producers
 * `Shared`: By default multiple producers can publish on a topic.
 * `WaitForExclusive`: Producer creation is pending until it can acquire 
exclusive access.

GitHub link: 
https://github.com/apache/pulsar/discussions/17703#discussioncomment-3669573

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org

Reply via email to