Skip to content

Commit

Permalink
scala3to scala2 post-downgrade fixes (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
ABMC831 authored Aug 23, 2024
1 parent 1ac34d0 commit c7e29cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object KafkaCase {
readerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")

// 2 -> MAKE READER (should be in using block for newer versions of scala)
val reader = new ReaderImpl[EdlaChangeTopic](readerProps, "KillMePleaseTopic") // must be assigned outside using, otherwise exception from constructor is swallowed by using block
val reader = new ReaderImpl[EdlaChangeTopic](readerProps, "KillMePleaseTopic")
try {
for (item <- reader)
println(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ class ReaderImpl[TType: Decoder](props: Properties, topic: String, timeout: Dura
private def fetchNextBatch(): util.Iterator[ConsumerRecord[String, String]] = {
log.info("Fetching next batch")
var nextIterator = consumer.poll(timeout).iterator()
while(neverEnding && !nextIterator.hasNext)
while(neverEnding && !nextIterator.hasNext) {
log.info("Re-Fetching next batch")
nextIterator = consumer.poll(timeout).iterator()
}
nextIterator
}
}
Expand Down

0 comments on commit c7e29cd

Please sign in to comment.