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