大家好,我是如何通过http akka ad获取数据并通过alpakka-kafka连接器发送到kafka的,这是我的来源:
object WebTrack extends App with Directives with LazyLogging {
val host = "localhost"
val port = 7070
val authorization = "Authorization"
val route = withSizeLimit(96239727) {
post {
headerValueByName("Authorization") { auth =>
entity(as[data]) { trans =>
//**************************I need send data to Alpakka Kafka connector********************************
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>"))
}
}
}
}
val bindingFuture = Http().bindAndHandleAsync(Route.asyncHandler(route), host, port)
.onComplete {
case Success(_) => {
logger.debug("This is very convenient ;-)")
println(s"Server online at http://localhost:7070 \\nPress RETURN to stop...")
}
case Failure(e) => {
println("Error Bind Http().bindAndHandleAsync")
}
}
}
1条答案
按热度按时间np8igboo1#
有这么多不同的事情,你可以做与阿克卡流
这里只有一个使用
Producer
Flume,根据文件https://doc.akka.io/docs/akka-stream-kafka/current/producer.html. 一定要退房passThrough
它可以做的一些事情: