zymap commented on a change in pull request #9938:
URL: https://github.com/apache/pulsar/pull/9938#discussion_r596472637
##########
File path: site2/docs/concepts-messaging.md
##########
@@ -53,6 +53,25 @@ Producers send messages to brokers synchronously (sync) or
asynchronously (async
| Sync send | The producer waits for an acknowledgement from the broker after
sending every message. If the acknowledgment is not received, the producer
treats the sending operation as a failure.
|
| Async send | The producer puts a message in a blocking queue and returns
immediately. The client library sends the message to the broker in the
background. If the queue is full (you can
[configure](reference-configuration.md#broker) the maximum size), the producer
is blocked or fails immediately when calling the API, depending on arguments
passed to the producer. |
+### Access mode
+
+You can have different types of access modes on topics for applications.
Review comment:
Is it better to change `applications` to `producers` ?because this is a
producer configuration.
##########
File path: site2/docs/concepts-messaging.md
##########
@@ -53,6 +53,25 @@ Producers send messages to brokers synchronously (sync) or
asynchronously (async
| Sync send | The producer waits for an acknowledgement from the broker after
sending every message. If the acknowledgment is not received, the producer
treats the sending operation as a failure.
|
| Async send | The producer puts a message in a blocking queue and returns
immediately. The client library sends the message to the broker in the
background. If the queue is full (you can
[configure](reference-configuration.md#broker) the maximum size), the producer
is blocked or fails immediately when calling the API, depending on arguments
passed to the producer. |
+### Access mode
+
+You can have different types of access modes on topics for applications.
+
+|Access mode | Description
+|---|---
+`Shared`|Multiple producers can publish on a topic. <br><br>This is the
**default** setting.
+`Exclusive`|Only one producer can publish on a topic. <br><br>If there is
already a producer connected, other producers trying to publish on this topic
get errors immediately.<br><br>The “old” producer is evicted and a “new”
producer is selected to be the next exclusive producer if the “old” producer
experiences a network partition with the broker.
+`WaitForExclusive`|If there is already a producer connected, the producer
creation is pending (rather than timing out) until the producer gets the
`Exclusive` access.<br><br>The producer that succeeds in becoming the exclusive
one is treated as the leader. Consequently, if you want to implement the leader
election scheme for your application, you can use this access mode.
+
+> **Note**
+>
+> Once an application creates a producer with the `Exclusive` or
`WaitForExclusive` access mode successfully, the instance of the application is
guaranteed to be the **only one writer** on the topic. Other producers trying
to produce on this topic get errors immediately or have to wait until they get
the `Exclusive` access.
+>
+> For more information, see [PIP 68: Exclusive
Producer](https://github.com/apache/pulsar/wiki/PIP-68:-Exclusive-Producer).
+
+You can set producer access mode through Java Client API. For more
information, see `ProducerAccessMode` in
[ProducerBuilder.java](https://github.com/apache/pulsar/blob/master/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerBuilder.java).
Review comment:
Use this link:
https://github.com/apache/pulsar/blob/c4aaf4105345534927ca3dfb8af197b4bd7b016d/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerBuilder.java
Master code might change so we need to use a permalink.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]