MessageQueue.PeekByLookupId MessageQueue.PeekByLookupId MessageQueue.PeekByLookupId MessageQueue.PeekByLookupId Method

定义

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 查看队列中特定的消息。Peeks at a specific message from the queue. 消息可通过查询标识符来指定,也可以通过其相对于队首或队尾的位置来指定。The message can be specified by a lookup identifier or by its position at the front or end of the queue.

重载

PeekByLookupId(Int64) PeekByLookupId(Int64) PeekByLookupId(Int64) PeekByLookupId(Int64)

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 从非事务性队列中查看与给定查找标识符匹配的消息。Peeks at the message that matches the given lookup identifier from a non-transactional queue.

PeekByLookupId(MessageLookupAction, Int64) PeekByLookupId(MessageLookupAction, Int64) PeekByLookupId(MessageLookupAction, Int64) PeekByLookupId(MessageLookupAction, Int64)

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 查看队列中特定的消息。Peeks at a specific message from the queue. 消息可通过查询标识符来指定,也可以通过其相对于队首或队尾的位置来指定。The message can be specified by a lookup identifier or by its position at the front or end of the queue.

PeekByLookupId(Int64) PeekByLookupId(Int64) PeekByLookupId(Int64) PeekByLookupId(Int64)

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 从非事务性队列中查看与给定查找标识符匹配的消息。Peeks at the message that matches the given lookup identifier from a non-transactional queue.

public:
 System::Messaging::Message ^ PeekByLookupId(long lookupId);
public System.Messaging.Message PeekByLookupId (long lookupId);
member this.PeekByLookupId : int64 -> System.Messaging.Message
Public Function PeekByLookupId (lookupId As Long) As Message

参数

lookupId
Int64 Int64 Int64 Int64

要查看的消息的 LookupIdThe LookupId of the message to peek at.

返回

Message,其 LookupId 属性匹配传入的 lookupId 参数。The Message whose LookupId property matches the lookupId parameter passed in.

异常

未能找到具有指定 lookupId 的消息。The message with the specified lookupId could not be found.

访问“消息队列”方法时出错。An error occurred when accessing a Message Queuing method.

注解

使用此方法可以读取具有已知查找标识符的消息, 而无需将其从队列中删除。Use this method to read a message with a known lookup identifier without removing it from the queue. 如果消息不在队列中, 此方法会立即引发异常。This method throws an exception immediately if the message is not in the queue.

消息LookupId的属性在消息所在的队列中是唯一的, 因此队列中最多存在一个与给定lookupId参数匹配的消息。The LookupId property of a message is unique to the queue where the message resides, so there will be at most one message in the queue that matches the given lookupId parameter.

若要读取具有指定查找标识符的消息并将其从队列中删除, 请ReceiveByLookupId使用方法。To read a message with a specified lookup identifier and remove it from the queue, use the ReceiveByLookupId method.

下表显示了此方法是否在各种工作组模式下可用。The following table shows whether this method is available in various Workgroup modes.

工作组模式Workgroup mode 可用Available
本地计算机Local computer Yes
本地计算机和直接格式名称Local computer and direct format name Yes
远程计算机Remote computer NoNo
远程计算机和直接格式名称Remote computer and direct format name Yes
另请参阅

PeekByLookupId(MessageLookupAction, Int64) PeekByLookupId(MessageLookupAction, Int64) PeekByLookupId(MessageLookupAction, Int64) PeekByLookupId(MessageLookupAction, Int64)

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 查看队列中特定的消息。Peeks at a specific message from the queue. 消息可通过查询标识符来指定,也可以通过其相对于队首或队尾的位置来指定。The message can be specified by a lookup identifier or by its position at the front or end of the queue.

public:
 System::Messaging::Message ^ PeekByLookupId(System::Messaging::MessageLookupAction action, long lookupId);
public System.Messaging.Message PeekByLookupId (System.Messaging.MessageLookupAction action, long lookupId);
member this.PeekByLookupId : System.Messaging.MessageLookupAction * int64 -> System.Messaging.Message
Public Function PeekByLookupId (action As MessageLookupAction, lookupId As Long) As Message

参数

action
MessageLookupAction MessageLookupAction MessageLookupAction MessageLookupAction

一个 MessageLookupAction 值,指定读取队列中消息的方式。One of the MessageLookupAction values, specifying how the message is read in the queue. 指定以下值之一:Specify one of the following: MessageLookupAction.Current:查看由 lookupId 指定的消息。MessageLookupAction.Current: Peeks at the message specified by lookupId.

MessageLookupAction.Next:查看由 lookupId 指定的消息的下一条消息。MessageLookupAction.Next: Peeks at the message following the message specified by lookupId.

MessageLookupAction.Previous:查看由 lookupId 指定的消息的前一条消息。MessageLookupAction.Previous: Peeks at the message preceding the message specified by lookupId.

MessageLookupAction.First:查看队列中的第一条消息。MessageLookupAction.First: Peeks at the first message in the queue. lookupId 参数必须设置为 0。The lookupId parameter must be set to 0.

MessageLookupAction.Last:查看队列中的最后一条消息。MessageLookupAction.Last: Peeks at the last message in the queue. lookupId 参数必须设置为 0。The lookupId parameter must be set to 0.

lookupId
Int64 Int64 Int64 Int64

要查看的消息的 LookupId 或者为 0。The LookupId of the message to peek at, or 0. 访问队列中的第一条和最后一条消息时使用 0。0 is used when accessing the first or last message in the queue.

返回

由传入的 actionlookupId 参数指定的 MessageThe Message specified by the action and lookupId parameters passed in.

异常

未能找到具有指定 lookupId 的消息。The message with the specified lookupId could not be found.

访问“消息队列”方法时出错。An error occurred when accessing a Message Queuing method.

注解

使用此方法可以读取具有已知查找标识符的消息, 而无需将其从队列中删除。Use this method to read a message with a known lookup identifier without removing it from the queue. 如果消息不在队列中, 此方法会立即引发异常。This method throws an exception immediately if the message is not in the queue.

消息LookupId的属性在消息所在的队列中是唯一的, 因此队列中最多存在一个与给定lookupId参数匹配的消息。The LookupId property of a message is unique to the queue where the message resides, so there will be at most one message in the queue that matches the given lookupId parameter.

若要读取具有指定标识符的消息并将其从队列中删除, 请ReceiveByLookupId使用方法。To read a message with a specified identifier and remove it from the queue, use the ReceiveByLookupId method.

下表显示了此方法是否在各种工作组模式下可用。The following table shows whether this method is available in various Workgroup modes.

工作组模式Workgroup mode 可用Available
本地计算机Local computer Yes
本地计算机和直接格式名称Local computer and direct format name Yes
远程计算机Remote computer NoNo
远程计算机和直接格式名称Remote computer and direct format name Yes
另请参阅

适用于