在网络浏览器上实时接收Kafka事件 [英] Receiving Kafka event on web browser real time

查看:60
本文介绍了在网络浏览器上实时接收Kafka事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Kafka集群实时发送/接收消息.我们能够成功发布有关Kafka主题的消息.现在,我们希望使用JavaScript在运行于Web浏览器上的单页应用程序(SPA)上实时接收这些消息.是否可以直接从Kafka将消息推送到运行在最新版本的SPA上的任何著名浏览器上?我发现了使用NodeJS实时接收消息的示例,但是没有在Web浏览器上运行JavaScript的示例.

We are using Kafka cluster for sending/receiving messages at real time. We are able to publish messages to Kafka topics successfully. Now we want to receive these messages real time on a Single Page Application (SPA) running on a web browsers using JavaScript. Is it possible to push messages to SPA running on latest version any famous browser directly from Kafka? I found examples of receiving messages realtime using NodeJS but none with the JavaScript running on web browser.

推荐答案

Kafka有Javascript客户端,但是鉴于用例的描述,我建议您在浏览器端javascript和Kafka之间使用REST或WebSocket代理.这样可以确保邮件可以穿越所有中间防火墙.

There are Javascript clients for Kafka but given the description of your use case I would recommend you either use a REST or WebSocket proxy between your browser side javascript and Kafka. That will ensure the message can traverse any intermediate firewalls.

这篇关于在网络浏览器上实时接收Kafka事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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