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/05/02 17:36:42 UTC

[GitHub] [pulsar] jerrypeng commented on a change in pull request #4093: [issue#4042] improve java functions API

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

 ##########
 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:
   @wolfstudy can you replace this with context.getLogger().error(e)

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