Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a call ACK / unack example to avoid confusing the retrial mechani… #11166

Merged
merged 4 commits into from
Jul 2, 2021

Conversation

yonyong
Copy link
Contributor

@yonyong yonyong commented Jun 30, 2021

Add a call ACK / unack example to avoid confusing the retrial mechanism for beginners

@yonyong yonyong closed this Jun 30, 2021
@yonyong yonyong reopened this Jun 30, 2021
@tuhaihe
Copy link
Contributor

tuhaihe commented Jun 30, 2021

@yonyong thanks for your contribution! 🤝

@Jennifer88huang-zz Jennifer88huang-zz added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Jun 30, 2021
@Jennifer88huang-zz Jennifer88huang-zz added this to the 2.9.0 milestone Jun 30, 2021
@@ -164,6 +170,12 @@ In the shared and Key_Shared subscription modes, you can negatively acknowledge

Be aware that negative acknowledgment on ordered subscription types, such as Exclusive, Failover and Key_Shared, can cause failed messages to arrive consumers out of the original order.

The following example shows how to call the API :

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```java

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also apply the change to other code snippets to mark the code block as Java language for correct highlight.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done

@@ -149,6 +149,17 @@ Messages can be acknowledged in the following two ways:
- Messages are acknowledged individually. With individual acknowledgement, the consumer needs to acknowledge each message and sends an acknowledgement request to the broker.
- Messages are acknowledged cumulatively. With cumulative acknowledgement, the consumer only needs to acknowledge the last message it received. All messages in the stream up to (and including) the provided message are not re-delivered to that consumer.

The following example shows how to call the API With individual acknowledgement:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example shows how to call the API With individual acknowledgement:
If you want to acknowledge messages individually, you can use the following API.

Pls keep consistent overall

```java
consumer.acknowledge(msg);
```
If you are going to acknowledge messages cumulatively, you can use the following API:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you are going to acknowledge messages cumulatively, you can use the following API:
If you want to acknowledge messages cumulatively, you can use the following API.

@@ -164,6 +175,13 @@ In the shared and Key_Shared subscription modes, you can negatively acknowledge

Be aware that negative acknowledgment on ordered subscription types, such as Exclusive, Failover and Key_Shared, can cause failed messages to arrive consumers out of the original order.

The following example shows how to call the API :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example shows how to call the API :
If you want to acknowledge messages negatively, you can use the following API.

@@ -242,6 +260,14 @@ Consumer<byte[]> consumer = pulsarClient.newConsumer(Schema.BYTES)
.subscribe();
```

The following example shows how to call the API to put messages into the retrial queue:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example shows how to call the API to put messages into the retrial queue:
If you want to put messages into a retrial queue, you can use the following API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sijie sijie merged commit c080c84 into apache:master Jul 2, 2021
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
apache#11166)

* Add a call ACK / unack example to avoid confusing the retrial mechanism for beginners

Co-authored-by: yangde <yangde@myai.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants