简体   繁体   English

使用MSMQ绑定使WCF服务异步

[英]Making WCF service async using MSMQ bindings

has anybody experience with async WCF endpoints? 有异步WCF端点的经验吗?

I am trying to understand if using the MSMQ bindings options I could have a setup in which the client knows to which queue the messages have to be put and would work transparently aslo if the wcf service (eventually hosted in IIS) is offline or does not responde. 我试图了解是否使用MSMQ绑定选项,我可以进行一个设置,使客户端知道必须将消息放入哪个队列,并且如果wcf服务(最终托管在IIS中)处于脱机状态或不处于脱机状态,则可以透明地正常工作responde。

I would really like to get this setup because in this way when the app server is back online (one of the many application servers we would have for our distributed application), it would process all incoming messages in the queue and elaborate. 我真的很想获得此设置,因为通过这种方式,当应用程序服务器重新联机(我们将为分布式应用程序提供的许多应用程序服务器之一)时,它将处理队列中的所有传入消息并进行详细说明。

I am more thinking about those operations which make sense to have delayed, like messaging management (sending emails out), logging services (write log entries to database, event log or send via email) and similar kind of backend processes. 我更多地考虑那些延迟的操作,例如消息传递管理(发送电子邮件),日志记录服务(将日志条目写入数据库,事件日志或通过电子邮件发送)以及类似的后端流程。

My other option would be to use TIBCO business works and ems but trying to understand what is better and if simple WCF would work sync or async simply changing the binding from let's say netTCP to MSMQ.... 我的另一个选择是使用TIBCO业务作品和ems,但尝试了解更好的东西,以及如果简单的WCF可以同步或异步工作,只需将绑定从netTCP更改为MSMQ。

Thanks! 谢谢!

You have to differentiate between async and queued. 您必须区分异步和排队。

You can do async messaging with, say, NetTcpBinding using client based async invocation, async service execution, OneWay messaging and duplex or simply OneWay messaging. 您可以使用基于客户端的异步调用,异步服务执行,OneWay消息传递和双工或仅使用OneWay消息传递与NetTcpBinding进行异步消息传递。

However, as you say, queues bring the additional benefits of: resilience, load levelling and, depending on the version of MSMQ, scalablility. 但是,正如您所说,队列带来了以下额外好处:弹性,负载均衡以及可扩展性(取决于MSMQ的版本)。

The main two issues you have using queues are: 使用队列的主要两个问题是:

  1. All messaging must be OneWay so if the client needs to have a way of knowing if processing was successful you have to design that into your solution 所有消息传递都必须是OneWay,因此如果客户端需要一种方法来了解处理是否成功,则必须将其设计到解决方案中
  2. Queue failure semantics are very different from standard service failures. 队列故障语义与标准服务故障非常不同。 Dead letter queues and poison message queues need to be checked for unprocessed messages - again something you need to design into your solution 需要检查死信队列和带毒消息队列中是否有未处理的消息-同样,您还需要在解决方案中进行设计

If you want equivalent to Tibco EMS then the only similar feature out-of-the box supported by WCF is MSMQ. 如果您希望获得与Tibco EMS相同的功能,那么WCF支持的现成的唯一类似功能就是MSMQ。 If you already have Tibco EMS infrastructure but you still want to use WCF you can combine these two because Tibco provides EMS binding for WCF (I have never tested it but I saw it on customer's download page). 如果您已经拥有Tibco EMS基础结构,但仍要使用WCF,则可以将两者结合使用,因为Tibco为WCF提供了EMS绑定(我从未测试过,但是在客户的下载页面上看到了)。

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

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