同时使用消息队列和数据库
我将开发一个涉及数据采集服务器的系统,其中每次采集都会填充一行。我还需要能够通知用户应用程序何时获取新数据。
根据我的阅读,使用数据库作为消息队列不是一个好主意,反之亦然,但我想知道是否可以同时使用两者?
采集应用程序可以将新行添加到数据库中,然后通知消息系统中的侦听器。这是否是此类系统的最佳方法?会不会太复杂了?是否有一种设计模式已经实现了这一点?
I will be developing a system that will involve a data acquisition server where each acquisition will fill a row. I also need to have the ability to inform the user application of when new data has been acquired.
From what I have read, it's not a good idea to use a database as a message queue and vice versa, but I was wondering if I could use both?
The acquisition application can add the new row into the database and then notify the listeners in the messaging system. Would this be the best approach for this type of system? Would it be too complex? Is there a design pattern that already implements this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,在数据库中插入一行和更新 GUI 是两个不同的操作,应该分开。
您的建议听起来不错:
Yes, inserting a row in the database and updating the GUI are two distinct operations, which should be separated.
What you are suggesting sounds good: