我必须使用来自 reactive-kafka 模块的代码:https ://github.com/akka/reactive-kafka/blob/master/README.md
我的代码以:
val kafka = new ReactiveKafka()
val kafkaIdpsMsgs: Publisher[StringKafkaMessage] = kafka.consume(
ConsumerProperties(
brokerList = kafkaHosts,
zooKeeperHost = zkHosts,
topic = "test",
groupId = "idps-translator",
decoder = new StringDecoder()
).readFromEndOfStream())
val kafkaSamples: Subscriber[String] = kafka.publish(ProducerProperties(
brokerList = kafkaHosts,
topic = "test",
encoder = new StringEncoder()
))
我想产生一条消息(由发布者)。我必须编写什么代码才能实现它?