2
카프카 서버를 설정하고 프로듀서를 사용하여 메시지를 보내 로컬로 코드를 테스트하려고 시도했지만이 경우 단위 테스트를 작성할 수있는 방법이 있는지 궁금합니다. 코드 조각 (소비자가받은 메시지가 올바른지 테스트).Akka Streams Kafka - 소비자 용 단위 테스트
val consumerSettings = ConsumerSettings(system,
new ByteArrayDeserializer, new StringDeserializer)
.withBootstrapServers("localhost:9092")
.withGroupId("group1")
.withProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")
val done = Consumer.committableSource(consumerSettings,
Subscriptions.topics("topic1"))
.map { msg =>
msg.committableOffset.commitScaladsl()
}
.runWith(Sink.ignore)