jtjeferreira commented on code in PR #226:
URL: 
https://github.com/apache/incubator-pekko-connectors/pull/226#discussion_r1300152995


##########
kinesis/src/main/scala/org/apache/pekko/stream/connectors/kinesis/impl/KinesisSchedulerSourceStage.scala:
##########
@@ -81,8 +81,14 @@ private[kinesis] class KinesisSchedulerSourceStage(
         override def shardRecordProcessor(): ShardRecordProcessor =
           new ShardProcessor(newRecordCallback)
       })
+      //Run the scheduler loop in a separate thread
+      val thread = new Thread(() => {
+        val result = Try {scheduler.run()}
+        callback.invoke(SchedulerShutdown(result))
+      }, s"KinesisSchedulerSource")
+      thread.setDaemon(true)
+      thread.start()
       schedulerOpt = Some(scheduler)
-      Future(scheduler.run()).onComplete(result => 
callback.invoke(SchedulerShutdown(result)))

Review Comment:
   > using a short lived daemon thread
   
   AFAICT this is will not be a short lived thread, but a long lived thread 
that will keep running as long as we want to read records from Kinesis.
   
   That said, I don't think running this "loop" in the default dispatcher even 
with "blocking" is a good idea, as it would block a thread for a long time... 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to