使用Windows服务通过WCF处理MSMQ消息 [英] Using Windows Services to process MSMQ messages via WCF

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

问题描述

我们有一个解决方案,其中我们使用Windows Service来挑选消息.

We have a solution where we are picking the messages using Windows Service.

Windows服务每2分钟触发一次,并检索MSMQ消息以将其传递给Web服务.

The Windows Service fires every after 2 minutes and retrieves the MSMQ message to pass it to a Web Service.

  1. 我可以创建一个WCF服务,该服务将自动从MSMQ队列中提取消息吗?
  2. 如果它支持自动调用,是否可以通过使用WCF服务来避免Windows Service?

推荐答案

Q1:您可以自动从MSMQ中提取消息,您将需要研究netmsmqbinding,尽管如此,您仍需要考虑一些设计注意事项,如果您习惯使用本机MSMQ,则知道您有能力查看消息.但是,当您使用WCF时,您会失去这种窥视的能力. WCF将截获MSMQ中的消息,您有责任使WCF服务和监视应用程序保持同步. 您还需要研究是否需要事务性队列或非事务性队列,并且必须基于此修改绑定.

Q1: you can automatically pick up messages from MSMQ, you will need to look into the netmsmqbinding, there are some design considerations that you have to think about though, if you are used to the native MSMQ, you know that you have the ability to peek at the messages. But when you use WCF, you loose that ability to peek. WCF will intercept the messages in MSMQ and you are responsible for keeping your WCF service and the peeking app in synch. You will also need to look into whether you need transactional or non-transactional queues and you will have to modify your binding based on that.

Q2:您将需要在Windows服务或IIS7中托管WCF服务.如果您托管在IIS7中,请考虑启用MSMQ WAS侦听器

Q2: You will need to host the WCF service in windows service or in IIS7. if you host in IIS7 look into enabling MSMQ WAS listener

这是一篇不错的文章: http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx

Here is a nice article: http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx

这篇关于使用Windows服务通过WCF处理MSMQ消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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