将路由器数据推送到分布式消息系统 [英] Pushing Router Data to DIstributed Messaging System

查看:19
本文介绍了将路由器数据推送到分布式消息系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查询:做一个router接口作为kafka集群的生产者.

Query: Making an interface of router as the producer of kafka cluster.

问题:我的路由器接口正在尝试将数据推送到运行 kafka 的端口.(默认为 9092).

Issue: My router's interface is trying to push the data to the port on which kafka is running. (by default 9092).

问.1 但是 kafka 代理可以在不创建主题的情况下接受这些数据吗?

Q. 1 But can the kafka broker accept this data without a topic being created ?

问.2 kafka 消费者可以在不指定主题的情况下拉取数据吗?

Q. 2 Can a kafka consumer pull data without specifying a topic ?

      If yes, How ?

      If not, What is work around this and how can i achieve this ?

第一次

我刚刚检查了 Kafka 代理配置是否具有auto.create.topics.enable"字段.如果我将此设置为 true 并在不使用kafka-console-producer"命令的情况下在 kafka 的端口上发送一些随机数据,那么 kafka 代理会接受吗?

I just checked that Kafka broker configs have "auto.create.topics.enable" field. If i set this as true and send some random data on kafka's port without using "kafka-console-producer" command, will the kafka broker accept it?

谢谢.

推荐答案

kafka broker 是否可以在不创建主题的情况下接受这些数据

can the kafka broker accept this data without a topic being created

默认情况下,Kafka 代理的设置方式是,如果您尝试将数据推送到它而它尚不存在,则它会创建主题.此行为由 auto.create.topics.enable 参数控制(带有 true/false 值).

By default Kafka broker is set up in a way that it creates topic if you're trying to push data to it and it does not exists yet. This behaviour is controlled by auto.create.topics.enable parameter (with true/false values).

但是broker 无法在没有创建主题的情况下接受数据.是的,必须在生产者端指定主题名称.

But broker cannot accept data without topic creation at all. And yes, topic name has to be specified on a producer side.

kafka 消费者可以在不指定主题的情况下拉取数据吗

Can a kafka consumer pull data without specifying a topic

不,不能.

如果没有,有什么办法可以解决这个问题,我该如何实现?

If not, What is work around this and how can i achieve this ?

您必须以某种方式检索主题名称,例如,通过 api 列出所有主题并选择合适的主题,或者您可以直接深入了解 zookeeper 内部结构,尽管我不建议您这样做.

You have to somehow retrieve topic name, for example, by listing all topics through the api and picking proper one, or you can dig directly into zookeeper internals, though I would not recommend you to do that.

我刚刚检查了 Kafka 代理配置是否具有auto.create.topics.enable"字段.如果我将此设置为 true 并在不使用kafka-console-producer"命令的情况下在 kafka 的端口上发送一些随机数据,那么 kafka 代理会接受吗?

I just checked that Kafka broker configs have "auto.create.topics.enable" field. If i set this as true and send some random data on kafka's port without using "kafka-console-producer" command, will the kafka broker accept it?

当然不是.Kafka使用自己的协议来建立生产者和经纪人、经纪人和消费者之间的连接,而且这些消息是专门编码的.

Of course not. Kafka uses it's own protocol to establish connection between producer and broker, broker and consumer, moreover, those messages are encoded specifically.

这篇关于将路由器数据推送到分布式消息系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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