MSMQ v Database Table

后端 未结 11 767
难免孤独
难免孤独 2020-12-24 07:24

An existing process changes the status field of a booking record in a table, in response to user input.

I have another process to write, that will run asynchronously

相关标签:
11条回答
  • 2020-12-24 07:44

    Also see previous discussion.

    0 讨论(0)
  • 2020-12-24 07:48

    Besides of Mitch's answer, some other scenarios: 1. each of your message have its own due date to trigger the action, this can be done through MQ as well, but in this case I prefer to store it into db as it is more controllable; 2. subscriber needs to filter message and then process a portion of it, this can be done by LINQ too, depends on how complex the filter is, the db approach is better because I can use linq to EF do complex query easily; 3. For deployment, i want fully automated deployment process so that DB is a better choice for me. I am not a big fan of manual configurations.

    0 讨论(0)
  • 2020-12-24 07:52

    I would probably go with MSMQ, or ActiveMQ myself. I would suggest (presuming that you are considering MSMQ you are using windows, with MS technology) looking into WCF, or if you are using MS-SQL 2005+ having a trigger that calls into .net code to run your processing.

    0 讨论(0)
  • 2020-12-24 07:55

    Service Broker was introduced in SQL 2005 and it is designed to be very quick at handling messages as the process is relatively simple (I believe its roots were in triggers). If you are concerned about scalability, in SQL 2008 they have released an independant processing executable to separate the processing from SQL Server (in standard Service Broker, everything is controlled by the SQL Server instances).

    I would definitely consider using Service Broker over MSMQ but this is dependant on your SQL Development/DBA resources and their knowledge.

    0 讨论(0)
  • 2020-12-24 07:57

    There are several reasons, which were discussed on the Fog Creek forum here: http://discuss.fogcreek.com/joelonsoftware5/default.asp?cmd=show&ixPost=173704&ixReplies=5

    The main benefit is that MSMQ can still be used when there is intermittant connectivity between computers (using a store and forward mechanism on the local machine). As far as the application is concerned it delivered the message to MSMQ, even though MSMQ will possibly deliver the message later.

    You can only insert a record to a table when you can connect to the database.

    A table approach is better when a workflow approach is required, and the process will move through various stages, and these stages need persisting in the DB.

    0 讨论(0)
  • 2020-12-24 07:57

    If the rate at which booking records is created is low I would have the second process periodically check the table for new bookings.

    Unless you are already using MSMQ, introducing it just gives you an extra platform component to support.

    If the database is heavily loaded, or you get a lot of lock contention with two process reading and writing to the same region of the bookings table, then consider introducing MSMQ.

    0 讨论(0)
提交回复
热议问题