jerrypeng commented on a change in pull request #4093: [WIP][issue#4042] 
improve java functions API
URL: https://github.com/apache/pulsar/pull/4093#discussion_r277795724
 
 

 ##########
 File path: 
pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/PublishFunction.java
 ##########
 @@ -30,7 +32,12 @@
     public Void process(String input, Context context) {
         String publishTopic = (String) 
context.getUserConfigValueOrDefault("publish-topic", "publishtopic");
         String output = String.format("%s!", input);
-        context.publish(publishTopic, output);
+        try {
+            TypedMessageBuilder<String> msgBuilder = 
context.newOutputMessage(publishTopic, null);
+            msgBuilder.value(output).sendAsync();
+        } catch (PulsarClientException e) {
+            e.printStackTrace();
 
 Review comment:
   can we use a logger to log this

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


With regards,
Apache Git Services

Reply via email to