0

I am relatively new to MS-MQ Development and I was wondering if any of you guru's out there know an answer to the following:

In the concept of queues, there is something called "peaking", whereby; you can look at the message on the queue BUT NOT take it off the queue. This is different to performing a GET call.

Does anyone know how to do this?

Thanks in Advance.

4

1 回答 1

3

嗯,这与从队列中接收消息没有太大区别。

var queue = new MessageQueue([path to queue]);

var msg = queue.Peek();

也可以通过使用迭代队列中的消息

var msg = queue.Peek(TimeSpan.FromSeconds(10), PeekAction.Next);

你也可以通过不同的ID偷看

  • PeekByCorrelationId
  • PeekByLookupId
  • PeekById

查看 MSDN 文档中有关这些方法的示例,因为它们可以让您轻松入门。

http://msdn.microsoft.com/en-us/library/829zyck7.aspx

于 2013-02-19T07:18:39.380 回答