rdhabalia closed pull request #2260: ack message for atmost processing guaranty
URL: https://github.com/apache/incubator-pulsar/pull/2260
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/sink/PulsarSink.java
 
b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/sink/PulsarSink.java
index 4be73018d3..b38cc8faab 100644
--- 
a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/sink/PulsarSink.java
+++ 
b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/sink/PulsarSink.java
@@ -82,7 +82,14 @@ public void initializeOutputProducer(String outputTopic) 
throws Exception {
         public void sendOutputMessage(MessageBuilder outputMsgBuilder,
                                       Record<T> recordContext) throws 
Exception {
             Message<byte[]> outputMsg = outputMsgBuilder.build();
-            this.producer.sendAsync(outputMsg);
+            this.producer.sendAsync(outputMsg).handle((messageId, e) -> {
+                if (log.isDebugEnabled()) {
+                    log.debug("[{}] failed to sink message {}", 
recordContext.getTopicName().orElseGet(() -> null),
+                            e.getMessage());
+                }
+                recordContext.ack();
+                return null;
+            });
         }
 
         @Override


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to