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 2021/04/28 11:24:45 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #10420: [Kinesis]Fix kinesis sink can not retry to send messages

codelipenghui commented on a change in pull request #10420:
URL: https://github.com/apache/pulsar/pull/10420#discussion_r622081653



##########
File path: pulsar-io/kinesis/src/main/java/org/apache/pulsar/io/kinesis/KinesisSink.java
##########
@@ -121,10 +130,8 @@ public void write(Record<byte[]> record) throws Exception {
                 ? partitionedKey.substring(0, maxPartitionedKeyLength - 1)
                 : partitionedKey; // partitionedKey Length must be at least one, and at most 256
         ByteBuffer data = createKinesisMessage(kinesisSinkConfig.getMessageFormat(), record);
-        ListenableFuture<UserRecordResult> addRecordResult = kinesisProducer.addUserRecord(this.streamName,
-                partitionedKey, data);
-        addCallback(addRecordResult,
-                ProducerSendCallback.create(this, record, System.nanoTime()), directExecutor());
+        Backoff backoff = new Backoff(1, TimeUnit.SECONDS, 1, TimeUnit.MINUTES, 0, TimeUnit.SECONDS);

Review comment:
       And it's better to make the initial timeout and max timeout configuable

##########
File path: pulsar-io/kinesis/src/main/java/org/apache/pulsar/io/kinesis/KinesisSink.java
##########
@@ -121,10 +130,8 @@ public void write(Record<byte[]> record) throws Exception {
                 ? partitionedKey.substring(0, maxPartitionedKeyLength - 1)
                 : partitionedKey; // partitionedKey Length must be at least one, and at most 256
         ByteBuffer data = createKinesisMessage(kinesisSinkConfig.getMessageFormat(), record);
-        ListenableFuture<UserRecordResult> addRecordResult = kinesisProducer.addUserRecord(this.streamName,
-                partitionedKey, data);
-        addCallback(addRecordResult,
-                ProducerSendCallback.create(this, record, System.nanoTime()), directExecutor());
+        Backoff backoff = new Backoff(1, TimeUnit.SECONDS, 1, TimeUnit.MINUTES, 0, TimeUnit.SECONDS);

Review comment:
       Do we need to create a Backoff instance for each data write process? We can just reuse the object by using the reset() method to reset the backoff?




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