You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "mdedetrich (via GitHub)" <gi...@apache.org> on 2023/08/18 20:31:40 UTC

[GitHub] [incubator-pekko-connectors] mdedetrich commented on a diff in pull request #226: kinesis: use stage materializer with IODispatcher instead of injected EC

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


##########
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:
   There is a `blocking` method on Scala's `Future` which might be a quick fix/solution?
   
   Should be something like
   
   ```scala
   Future {
     blocking {
       scheduler.run()
     }
   }.onComplete(result => callback.invoke(SchedulerShutdown(result)))
   ```
   



-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org