Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend 如何发送消息到设备时,是如何指定设备连接在哪个gateway上面的? #1

Closed
chowyu08 opened this issue Aug 6, 2019 · 6 comments
Labels
question Further information is requested

Comments

@chowyu08
Copy link

chowyu08 commented Aug 6, 2019

主动下发消息的情况

@hb-chen
Copy link
Owner

hb-chen commented Aug 6, 2019

现在没有指定设备发送,消息发送流程

  • 先发送到broker
  • Gateway上的设备订阅topic,Gateway再订阅broker
  • 哪些Gateway订阅了,哪些就去消费broker的消息
  • 再由Gateway将消息发送到订阅这个消息的设备

@chowyu08
Copy link
Author

chowyu08 commented Aug 6, 2019

设备订阅的时候,gateway会订阅一个对应的topic到broker(kafka),这样topic会不会太多了?
我看你是根据topic,某一段序列指定订阅的broker,多个gateway节点,可能会订阅broker相同的topic吗?

@hb-chen
Copy link
Owner

hb-chen commented Aug 6, 2019

Gateway只订阅一级topic(比如a/b/c,Gateway订阅的是a),然后在消息里有完整topic

对,多个Gateway会消费相同的topic

@chowyu08
Copy link
Author

chowyu08 commented Aug 6, 2019

这样的话,backend srv收到消息后,回复的响应没办法保证client能收到了

@hb-chen
Copy link
Owner

hb-chen commented Aug 6, 2019

对,只代表broker将消息接收,而且只有实时在线的终端能够收到,适用场景比较有限
如果要保证订阅的client都能收到,需要做client订阅topic的持久化,client对消息的消费进度也要持久化,并且消息的消费变分散,这种是读放大;或者每个client都有一个消息待发送队列,也就是写放大。

大致这样的框架
IoT

@chowyu08
Copy link
Author

chowyu08 commented Aug 6, 2019

好的,谢谢,非常棒的框架

@hb-chen hb-chen added the question Further information is requested label Aug 6, 2019
@hb-chen hb-chen closed this as completed Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants