You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/21 03:48:33 UTC

[GitHub] [pulsar] Anonymitaet commented on a change in pull request #10982: [docs] Replace endless while loops with MessageListner

Anonymitaet commented on a change in pull request #10982:
URL: https://github.com/apache/pulsar/pull/10982#discussion_r655055855



##########
File path: site2/docs/client-libraries-java.md
##########
@@ -243,16 +243,14 @@ Once you've instantiated a {@inject: javadoc:PulsarClient:/client/org/apache/pul
 Consumer consumer = client.newConsumer()
         .topic("my-topic")
         .subscriptionName("my-subscription")
+        .messageListener(myMessageListener)
         .subscribe();
 ```
 
-The `subscribe` method will auto subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to set up a `while` loop. In this example loop, the consumer listens for messages, prints the contents of any received message, and then [acknowledges](reference-terminology.md#acknowledgment-ack) that the message has been processed. If the processing logic fails, you can use [negative acknowledgement](reference-terminology.md#acknowledgment-ack) to redeliver the message later.
+The `subscribe` method will auto subscribe the consumer to the specified topic and subscription. One way to make the consumer listen on the topic is to add a `MessageListener`. In this example, the consumer listens for messages, prints the contents of any received message, and then [acknowledges](reference-terminology.md#acknowledgment-ack) that the message has been processed. If the processing logic fails, you can use [negative acknowledgement](reference-terminology.md#acknowledgment-ack) to redeliver the message later.

Review comment:
       @BewareMyPower could you please help review? Thanks




-- 
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:
users@infra.apache.org