收到通知,当Kafka生产者上线或下线时。

huangapple go评论65阅读模式
英文:

get notifications when kafka producer is online or offline

问题

我正在使用Spring Boot作为RestAPI,前端使用Angular构建网站。此外,我将通过Kafka从约40-50个独立的Swing应用程序(生产者)获取数据,并在我的Rest(消费者)中使用。我需要为这些Swing应用程序实现在线状态。基本上,我需要知道Swing应用程序中的哪一个何时下线或重新上线。是否有一种实现这一点的方法?如果使用Kafka不可能实现,您能推荐其他通信方式吗?

澄清:
在线状态是指安装了Swing应用程序的设备是否有互联网连接。
Swing应用程序将安装在远程位置的约40-50台设备上。

英文:

I'm building a website using springboot as RestAPI and angular in frontend. Also, i will be getting data in my rest(consumer) from around 40-50 swing standalone apps(producers) through kafka. I need to implement online status for those swing apps. Basically, i need to know when and which one of swing apps went offline or back online. Is there a way to implement this? If this is impossible with kafka can you recommend something else for communication?

Clarification:
By online status i mean whether device on which swing app is installed has internet connection or not.
Swing app will be installed on around 40-50 devices on remote locations.

答案1

得分: 0

最终我摒弃了Kafka,而是使用了Websockets。使用WebSocketHandler,我可以获得某个独立应用连接或断开连接的信息。当独立应用失去互联网连接时,服务器会在相对较短的时间内(60秒内)得到通知。请注意,在我的情况下,独立应用会经常发送数据。如果这不适用于您的情况,我建议寻找其他解决方案,并查看@OneCriketeer关于Nagios的评论。

英文:

Eventually i got rid of kafka and used websockets. Using WebSocketHandler i had information when certain standalone app is connected or disconnected. When standalone app looses internet connection server is notified relatively quickly (within 60 seconds). Keep in mind that in my case standalone app will be sending data quite often. If this is not the case for you then i recommend looking for some other solutions and taking a look at @OneCriketeer comment regarding Nagios.

huangapple
  • 本文由 发表于 2020年8月6日 04:46:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/63273255.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定