简体   繁体   English

使用WCF的MSMQ侦听器?

[英]MSMQ listener with WCF?

Scenario : I want to implement an MSMQ in which users input message through System.Messaging API's. 场景:我想实现一个MSMQ,用户可以通过其中的System.Messaging API输入消息。 And there should be a listener which always observes this queue so when ever there is a message in queue I want to make a database updation. 并且应该有一个侦听器,该侦听器始终观察此队列,因此,只要队列中有消息,我都希望进行数据库更新。

My first approach was to implement MSMQ trigger. 我的第一种方法是实现MSMQ触发器。 I was able to implement a COM interop dll trigger. 我能够实现COM互操作dll触发器。 But I wasnt able to do database operation and I couldnt figure out what was wrong, I tried a lot . 但是我无法进行数据库操作,也无法弄清楚出了什么问题,我做了很多尝试。 Then I came to know about this WCF MSMQ binding. 然后我开始了解这种WCF MSMQ绑定。 As I am new to this WCF I have some doubts. 由于我是本届WCF的新手,我对此有些怀疑。

Which is the best approach to host WCF for this case. 对于这种情况,哪种是托管WCF的最佳方法。 Is it IIS with WAS or Windows service? 是带有WAS或Windows服务的IIS?

And for this kind of listener service is a client necessary or can we write the database operations directly under the Service host operations without client invocation? 并且对于这种侦听器服务来说,客户端是必需的,或者我们可以在不调用客户端的情况下直接在Service主机操作下编写数据库操作吗?

Then I came to know about this WCF MSMQ binding. 然后我开始了解这种WCF MSMQ绑定。 As I am new to this WCF I have some doubts 由于我是这个WCF的新手,所以我有些怀疑

Well, that's valid. 好吧,那是有效的。 WCF has a fairly steep learning curve, is very config-heavy, and is not everyone's cup of tea . WCF的学习曲线相当陡峭,配置繁重,而且不是每个人的功课

However, if you're integrating to MSMQ, WCF has very good support and is rock solid in terms of the way it is implemented. 但是,如果您要集成到MSMQ,则WCF会提供很好的支持,并且在实现方式上是坚如磐石。

Which is the best approach to host WCF for this case. 对于这种情况,哪种是托管WCF的最佳方法。 Is it IIS with WAS or Windows service? 是带有WAS或Windows服务的IIS?

Unless you're hosting exclusively on a web environment, I would choose a windows service every time. 除非您专门在Web环境上托管,否则我每次都会选择Windows服务。 Using something like topshelf , the deployment and management overhead is tiny, and there are no external dependencies. 使用诸如topshelf之类的东西 ,部署和管理开销很小,并且没有外部依赖关系。

Remember to use msmqIntegrationBinding rather than netMsmqBinding, as the latter relies on WCF at both ends, whereas the former supports System.Messaging on the client, or even better, use WCF on the client and then you can use netMsmqBinding which support "typed" messages. 记住要使用msmqIntegrationBinding而不是netMsmqBinding,因为后者两端都依赖WCF,而前者在客户端上支持System.Messaging,甚至更好,请在客户端上使用WCF,然后可以使用netMsmqBinding来支持“类型化”消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM