Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
[Improved] Better kafka at least once test
Browse files Browse the repository at this point in the history
Signed-off-by: amannocci <[email protected]>
  • Loading branch information
amannocci committed Aug 19, 2020
1 parent a605d34 commit e95f560
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ private class GraphiteParser(config: GraphiteTransformer.Config) extends ByteStr
true
}

@inline private def parseUntilDelimiter(field: Option[String]): Boolean =
capture(oneOrMore(GraphiteParser.DelimiterMatcher)) { value =>
field.foreach(bind => builder += bind -> JsString.fromByteStringUnsafe(value))
true
}

override def cleanup(): Unit = {
super.cleanup()
builder = Json.objectBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
*/
package io.techcode.streamy.kafka.component

import akka.kafka.ConsumerMessage.CommittableOffset
import akka.Done
import akka.stream.scaladsl.Flow
import io.techcode.streamy.event.StreamEvent
import io.techcode.streamy.kafka.util.KafkaSpec
import scala.concurrent.duration._
import scala.language.postfixOps

/**
* Kafka source spec.
Expand All @@ -39,12 +41,15 @@ class KafkaSourceSpec extends KafkaSpec {
val groupId = createGroupId()

awaitProduce(produceString(topic, Seq("foobar")))
KafkaSource.atLeastOnce(KafkaSource.Config(
val control = KafkaSource.atLeastOnce(KafkaSource.Config(
handler = Flow[StreamEvent],
bootstrapServers = bootstrapServers,
groupId = groupId,
topics = KafkaSource.StaticTopicConfig(Set(topic))
))
whenReady(control.drainAndShutdown(), timeout(60 seconds), interval(100 millis)) { x =>
x should equal(Done)
}
}
}

Expand Down

0 comments on commit e95f560

Please sign in to comment.