ערוך

שתף באמצעות


MessageQueue.PeekByLookupId Method

Definition

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.

Overloads

PeekByLookupId(Int64)

Introduced in MSMQ 3.0. Peeks at the message that matches the given lookup identifier from a non-transactional queue.

PeekByLookupId(MessageLookupAction, Int64)

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)

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

Parameters

lookupId
Int64

The LookupId of the message to peek at.

Returns

The Message whose LookupId property matches the lookupId parameter passed in.

Exceptions

MSMQ 3.0 is not installed.

The message with the specified lookupId could not be found.

An error occurred when accessing a Message Queuing method.

Remarks

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.

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.

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 No
Remote computer and direct format name Yes

See also

Applies to

PeekByLookupId(MessageLookupAction, Int64)

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

Parameters

action
MessageLookupAction

One of the MessageLookupAction values, specifying how the message is read in the queue. Specify one of the following:

MessageLookupAction.Current: Peeks at the message specified by lookupId.

MessageLookupAction.Next: Peeks at the message following the message specified by lookupId.

MessageLookupAction.Previous: Peeks at the message preceding the message specified by lookupId.

MessageLookupAction.First: Peeks at the first message in the queue. The lookupId parameter must be set to 0.

MessageLookupAction.Last: Peeks at the last message in the queue. The lookupId parameter must be set to 0.

lookupId
Int64

The LookupId of the message to peek at, or 0. 0 is used when accessing the first or last message in the queue.

Returns

The Message specified by the action and lookupId parameters passed in.

Exceptions

MSMQ 3.0 is not installed.

The message with the specified lookupId could not be found.

An error occurred when accessing a Message Queuing method.

The action parameter is not one of the MessageLookupAction members.

Remarks

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.

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.

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 No
Remote computer and direct format name Yes

See also

Applies to