如何将Android App用作“生产客户端"为了卡夫卡? [英] How to use Android App as a "Producing client" for Kafka?

查看:94
本文介绍了如何将Android App用作“生产客户端"为了卡夫卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以/将Android应用程序用作Apache Kafka的生产客户端"?

Is it possible / does it make sense to use an Android app as a "Producing client" for Apache Kafka?

假设我的Android应用程序需要捕获和分析反应时间数据.目标是收集所有数据并在App中实时显示平均反应时间.

Let's say my Android App need to capture and analyse reaction time data. Goal is to collect all data and show the average reaction time in real-time in the App.

另一种选择是将某种类型的应用服务器作为 接受来自android应用程序的消息并将其发布到的中介 Kafka,而不是让该应用程序独自成为Kafka Producer.

The alternative is having an app server of some kind as an intermediary that accepts messages from the android app and posts them to Kafka, rather than having the app be a Kafka Producer on its own.

推荐答案

即使有可能,我认为它也有一些缺点.

Even if it's possible, in my opinion it has some disadvantages.

总的来说,我希望客户尽可能地简单,以避免维护问题.相反,我会通过我的应用服务器上的REST API路由所有客户端请求.缺点与Kafka无关,而是本地客户端的常见问题.

In general I like clients to be as simple as possible to avoid maintenance issues. Instead I'd route all client requests through a REST API on my app server. The disadvantages are not related to Kafka, but are common problems of native clients.

联轴器

您正在将Android应用程序紧密耦合到消息传递基础结构.如果以后您认为Kafka解决方案太多了,而Plain Old Java就足够了,那么您首先必须更新Android应用程序,然后等到足够多的用户进行更新为止.

You're coupling the Android app closely to your messaging infrastructure. If you later decide that a Kafka solution is too much and Plain Old Java would be good enough, you'll first have to update the Android app and wait until enough users do an update.

身份验证

可能您的应用程序中已经进行了某种身份验证.您还可以创建与Kafka进行身份验证的连接.因此,您将拥有两条身份验证路径,而对于应用服务器,Kafka只需要检查请求是否来自受信任的应用服务器,这意味着实现工作量较小.

Probably you already have some kind of authentication in your app. You can also create authenticated connections to Kafka. So you'll have two authentication paths, whereas with an app server Kafka only needs to check if the requests are coming from the trusted app server, which means less implementation effort.

...

这篇关于如何将Android App用作“生产客户端"为了卡夫卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆