使用Windows服务和SQL Server中的单向WCF消息队列 [英] Queuing in OneWay WCF Messages using Windows Service and SQL Server

查看:215
本文介绍了使用Windows服务和SQL Server中的单向WCF消息队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现一个排队机制,WCF服务请求。该服务将通过客户在单向方式被调用。这些请求消息应存储在SQL Server数据库和Windows服务队列中的邮件。在该请求进行处理的时间将是可配置的。如果在处理消息发生错误时,它需要重试多达100倍,如果仍然失败它需要被终止。

另外应该有一种机制来监测取得的某一天和失败的数目交易的数目。

问题

  1. 如果我用MSMQ,客户可能已经转移到不知道服务端点排队的消息。但是,我使用SQL Server存储的请求消息。客户端可以如何把请求发送到SQL Server的?

  2. 是解决方案是否可行?我们是否有任何文章/书,介绍了如何实现上述?

  3. 有哪些步骤,以prevent服务和客户端在这种情况下达到故障状态?

  4. 什么是收到的邮件存储到数据库中的最好的方法?

  5. 什么是实现重试机制的最佳方法是什么?任何已经存在,这样我就不必重新发明轮子?

  6. 有没有什么书/文章解释这种实现?


注意

  1. 消息的内容将是复杂的XML。例如旅行的员工或员工列表的费用项目。

阅读

  1. 登录WCF请求数据库

  2. <一个href="http://stackoverflow.com/questions/4411510/guaranteed-processing-of-data-in-wcf-service">Guaranteed数据的WCF服务处理

  3. MSMQ与SQL Server的服务中介

  4. <一个href="http://stackoverflow.com/questions/6887509/is-it-possible-to-persist-and-then-forward-wcf-messages-to-destination-services">Is有可能坚持再往前WCF消息目的地服务?

  5. WCF 4路由服务 - 协议桥接问题

  6. <一个href="http://programmers.stackexchange.com/questions/134605/designing-a-scalable-and-robust-retry-mechanism">http://programmers.stackexchange.com/questions/134605/designing-a-scalable-and-robust-retry-mechanism

  7. <一个href="http://stackoverflow.com/questions/7418835/integrating-sql-service-broker-and-nservicebus">Integrating SQL服务代理和NServiceBus

  8. <一个href="http://stackoverflow.com/questions/2437423/can-a-subscriber-also-publish-send-message-in-nservicebus">Can用户还发布/发送消息NServiceBus?

解决方案

这听起来像你想要做的是类似这样的:

在这种情况下,你可以使用netMsmqBinding您服务,您的服务消费者之间。

您不会得到开箱即用的唯一事情是重试。但是,如果你做的队列事务那么这个功能可以在您的服务code来实现。

如果有一个在您解列操作失败的消息将不被从队列中删除。因此,将可用于进一步出队的尝试。

不过,你需要实现重试尝试门槛code这在一定次数的尝试后失败的消息。

I need to implement a queuing mechanism for WCF service requests. The service will be called by clients in a one-way manner. These request messages should be stored in a SQL Server database and a Windows Service queues the messages. The time at which the requests are processed will be configurable. If there happens error in processing the message, it need to be retried up to 100 times and if still fails it need to be terminated.

Also there should be a mechanism to monitor the number of transaction made on a day and number of failures.

QUESTIONS

  1. If I were using MSMQ, clients could have forwarded the message to queue without knowing the service endpoint. But I am using SQL Server to store the request messages. How the clients can put the requests to SQL Server?

  2. Is the solution feasible? Do we have any article/book that explains how to implement the above?

  3. What are the steps to prevent service and client reaching faulted state in this scenario?

  4. What is the best method to store incoming message to database?

  5. What is the best method to implement retry mechanism? Anything already exist so that I don't have to reinvent the wheel?

  6. Is there any book/article that explains this implementation?


NOTES

  1. Content of the message will be complex XML. For example Travel expense items of an employee or a list of employees.


READING

  1. Logging WCF Request to Database

  2. Guaranteed processing of data in WCF service

  3. MSMQ vs. SQL Server Service Broker

  4. Is it possible to persist and then forward WCF messages to destination services?

  5. WCF 4 Routing Service - protocol bridging issue

  6. http://programmers.stackexchange.com/questions/134605/designing-a-scalable-and-robust-retry-mechanism

  7. Integrating SQL Service Broker and NServiceBus

  8. Can a subscriber also publish/send message in NServiceBus?

解决方案

It sounds like what you want to do is similar to this:

In this case you can use netMsmqBinding between your service and your service consumers.

The only thing you won't get out of the box is the retrying. However if you make the queue transactional then this functionality can be implemented in your service code.

If there is a failure in your dequeue operation the message will not be removed from the queue. It will therefore be available for further dequeue attempts.

However, you would need to implement retry attempt threshold code which fails a message after a certain number of attempts.

这篇关于使用Windows服务和SQL Server中的单向WCF消息队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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