MSMQ v数据库表 [英] MSMQ v Database Table

查看:70
本文介绍了MSMQ v数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现有流程会根据用户输入更改表中预订记录的状态字段.

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

我要编写另一个进程,该进程将针对具有特定状态的记录异步运行.它将读取表记录,执行一些操作(包括对第三方Web服务的调用),并更新记录的状态字段以指示处理已完成(或错误,错误计数).

I have another process to write, that will run asynchronously for records with a particular status. It will read the table record, perform some operations (including calls to third party web services), and update the record's status field to indicate that processing is completed (or In Error, with an error count).

此操作听起来与队列非常相似.在这种情况下,在SQL表上使用MSMQ有什么好处和缺点,为什么我应该选择一个而不是另一个?

This operation sounds very similar to a queue. What are the benefits and tradeoffs of using MSMQ over a SQL Table in this situation, and why should I choose one over the other?

这是我们的软件,用于添加和更新表中的记录.

It is our software that is adding and updating records in the table.

这是一项新的工作(Windows服务),将执行异步处理.这需要始终保持".

It is a new piece of work (a Windows Service) that will be performing the asynchronous processing. This needs to be "always up".

推荐答案

有几种原因,在以下Fog Creek论坛上进行了讨论:

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

主要优点是,当计算机之间存在间歇性连接(使用本地计算机上的存储和转发机制)时,仍可以使用MSMQ.就应用程序而言,即使MSMQ稍后可能会传递消息,它也会将消息传递给MSMQ.

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.

这篇关于MSMQ v数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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