MSMQMessage.Priority (Compact 2013)

3/26/2014

This property specifies the message's priority. A low number indicates a low priority message.

Syntax

HRESULT get_Priority( 
  long* plPriority 
);
HRESULT put_Priority( 
  long lPriority
);

Parameters

  • plPriority or lPriority
    Integer value between 7 and 0, where 0 indicates a low priority message.

    The default is 3.

Return Value

The following table describes the common return values.

Value

Description

S_OK

Success

E_INVALIDARG

One or more arguments are invalid

E_NOTIMPL

The function contains no implementation

E_OUTOFMEMORY

Out of memory

Remarks

Message priority effects how Message Queuing handles the message while it is in route, as well as where the message is placed in the queue.

Higher priority messages are given preference during routing, and inserted toward the front of the queue.

For example, when routing messages Message Queuing handles messages with a priority of 7 before it handles messages with a priority of 0, When the message is delivered to the destination queue, Message Queuing places the priority 7 messages closer to the front of the queue.

Messages with the same priority are placed in the queue according to their arrival time.

Messages sent to public queues

When Message Queuing routes a message to a public queue, the priority level of the message is added to the priority level of the public queue (the priority level of the queue is specified by the MSMQQueueInfo.BasePriority property of the queue). However, the priority level of the queue has no effect on how messages are placed in the queue.

Message priority within transactions

Message Queuing sets the priority level of transactional messages to 0: MSMQMessage.Priority is ignored by the transaction.

Equivalent Function Property

When using MSMQ functions, the priority level of a message can be set using PROPID_M_PRIORITY.

Requirements

Header

mqoai.h

Library

mqoa.lib

See Also

Reference

MSMQMessage
MSMQQueueInfo.BasePriority
PROPID_M_PRIORITY