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 2019/11/19 01:41:14 UTC

[GitHub] [pulsar] huangdx0726 opened a new pull request #5691: [Issues 5681] fix example code of java client

huangdx0726 opened a new pull request #5691: [Issues 5681] fix example code of java client
URL: https://github.com/apache/pulsar/pull/5691
 
 
   [Issues 5681] fix example code of java client
   
   Fixes #5681 
   
   ### Motivation
   
   The example code  of java client can't work.
   ```
   Producer<String> producer = PulsarUtils.getClient().newProducer(Schema.STRING)
                   .topic("my-topic")
                   .enableBatch(false)
                   .create();
   // 3 messages with "key-1", 3 messages with "key-2", 2 messages with "key-3" and 2 messages with "key-4"
           producer.newMessage().key("key-1").value("message-1-1").send();
           producer.newMessage().key("key-1").value("message-1-2").send();
           producer.newMessage().key("key-1").value("message-1-3").send();
           producer.newMessage().key("key-2").value("message-2-1").send();
           producer.newMessage().key("key-2").value("message-2-2").send();
           producer.newMessage().key("key-2").value("message-2-3").send();
           producer.newMessage().key("key-3").value("message-3-1").send();
           producer.newMessage().key("key-3").value("message-3-2").send();
           producer.newMessage().key("key-4").value("message-4-1").send();
           producer.newMessage().key("key-4").value("message-4-2").send();
   ```
   
   ### Modifications
   
   change the enableBatch method to enableBatching.
   

----------------------------------------------------------------
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


With regards,
Apache Git Services