pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] merlimat commented on a change in pull request #3704: On publish failures, log error and count them as sys exceptions
Date Wed, 27 Feb 2019 22:45:34 GMT
merlimat commented on a change in pull request #3704: On publish failures, log error and count
them as sys exceptions
URL: https://github.com/apache/pulsar/pull/3704#discussion_r260978312
 
 

 ##########
 File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/ContextImpl.java
 ##########
 @@ -359,7 +362,11 @@ public ByteBuffer getState(String key) {
             }
         }
 
-        return producer.sendAsync(object).thenApply(msgId -> null);
+        return producer.sendAsync(object).exceptionally(e -> {
 
 Review comment:
   This is returning a future that is masking the eventual error. It should be something like
: 
   
   ```java
   CompletableFuture<Void> future = producer.sendAsync(object).thenApply(msgId ->
null);
   future.exceptionally(e -> {
        this.statsManager.incrSysExceptions(e);
        logger.error("Failed to publish to topic {} with error {}", topicName, e);
        return null;
   });
   return future;
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Mime
View raw message