Using both a message queue and database
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 开发者_StackOverflow中文版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?
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:
- insert a row in the DB
- notify the user application via a notification mechanism (listeners will do fine).
精彩评论