This documentation is archived and is not being maintained.

Message.UseDeadLetterQueue Property

Gets or sets a value that indicates whether a copy of the message that could not be delivered should be sent to a dead-letter queue.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

public bool UseDeadLetterQueue { get; set; }
/** @property */
public boolean get_UseDeadLetterQueue ()

/** @property */
public void set_UseDeadLetterQueue (boolean value)

public function get UseDeadLetterQueue () : boolean

public function set UseDeadLetterQueue (value : boolean)

Not applicable.

Property Value

true if message-delivery failure should result in a copy of the message being sent to a dead-letter queue; otherwise, false. The default is false.

Exception typeCondition

InvalidOperationException

The message queue is filtered to ignore the UseDeadLetterQueue property.

The UseJournalQueue and UseDeadLetterQueue properties specify how Message Queuing tracks a message. If UseDeadLetterQueue is true, delivery failure (of a non-transactional message), causes the message to be sent to the non-transactional dead-letter queue on the computer that could not deliver the message. Delivery failure could be caused by a message timer expiring, for example.

In the case of delivery failure for a transactional message, Message Queuing sends the message to the transactional dead-letter queue on the source machine in all negative and in-doubt cases.

When you store messages in a dead-letter queue, you should clear the queue periodically to remove messages that are no longer needed. Messages stored in dead-letter queues count against the size quota for the computer where the queue resides. The computer quota is set by the administrator and refers to the size allocated for storing messages on the whole computer, not just in a single queue.

You do not create a journal or dead-letter queue. These are both system queues that Message Queuing generates.

The following code example gets and sets the value of a message's UseDeadLetterQueue property.

// Set the message's UseDeadLetterQueue property.
orderMessage.UseDeadLetterQueue = true;

// Display the new value of the message's UseDeadLetterQueue property.
Console.WriteLine("Message.UseDeadLetterQueue: {0}",
    orderMessage.UseDeadLetterQueue);

// Set the message's UseDeadLetterQueue property.
orderMessage.set_UseDeadLetterQueue(true);
// Display the new value of the message's UseDeadLetterQueue property.
Console.WriteLine("Message.UseDeadLetterQueue: {0}", 
    System.Convert.ToString(orderMessage.get_UseDeadLetterQueue()));

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0
Show: