MSMQ-按路径获取特定队列 [英] MSMQ - Get specific queue by path

查看:122
本文介绍了MSMQ-按路径获取特定队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感到奇怪的是,在MSMQ中有一个名为MessageQueue.ExistsMessageQueue.Create的方法.但是,即使提到的两个方法都将路径作为参数,也没有方法可以检索队列的路径.

I find it strange that in MSMQ there's a method called MessageQueue.Exists and MessageQueue.Create. However, there's no method for retrieving a queue given its path, even though the two mentioned methods take a path as an argument.

如何通过其路径有效检索队列?

How can I retrieve a queue efficiently by its path?

我可以做到:

MessageQueue.GetPrivateQueuesByMachine(".").First(m => m.Path == "something");

但是我不会称其为纯效率.我的机器将处理大量队列消息,目前有多达250个队列在运行.

But I wouldn't call that pure nor efficient. My machine will handle large quantities of queue messages flowing around, with as much as 250 queues running currently.

这些队列中的大多数都是从ASP .NET MVC站点处理的,在该站点中我无法存储"队列的引用以供以后使用.对于每个请求,每个队列都需要重新获取.

Most of these queues are being handled from an ASP .NET MVC site, where I can't "store" a queue's reference for later use. Every queue will need to be fetched again for every request.

推荐答案

使用MessageQueue 查看全文

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