TechNet
Export (0) Print
Expand All

DefaultPropertiesToSend Class

 

Specifies the default property values that will be used when sending objects other than Message instances to a message queue.

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

System.Object
  System.Messaging.DefaultPropertiesToSend

[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
public class DefaultPropertiesToSend

NameDescription
System_CAPS_pubmethodDefaultPropertiesToSend()

Initializes a new instance of the DefaultPropertiesToSend class.

NameDescription
System_CAPS_pubpropertyAcknowledgeType

Gets or sets the type of acknowledgement message to be returned to the sending application.

System_CAPS_pubpropertyAdministrationQueue

Gets or sets the queue that receives acknowledgement messages generated by Message Queuing.

System_CAPS_pubpropertyAppSpecific

Gets or sets additional, application-specific information.

System_CAPS_pubpropertyAttachSenderId

Gets or sets a value that indicates whether the sender ID should be attached to the message.

System_CAPS_pubpropertyEncryptionAlgorithm

Gets or sets the encryption algorithm used to encrypt the body of a private message.

System_CAPS_pubpropertyExtension

Gets or sets additional information associated with the message.

System_CAPS_pubpropertyHashAlgorithm

Gets or sets the hashing algorithm used when authenticating messages or creating a digital signature for a message.

System_CAPS_pubpropertyLabel

Gets or sets an application-defined string that describes the message.

System_CAPS_pubpropertyPriority

Gets or sets the message priority, which is used to determine where the message is placed in the queue.

System_CAPS_pubpropertyRecoverable

Gets or sets a value that indicates whether the message is guaranteed to be delivered in the event of a computer failure or network problem.

System_CAPS_pubpropertyResponseQueue

Gets or sets the queue that receives application-generated response messages.

System_CAPS_pubpropertyTimeToBeReceived

Gets or sets the time limit for the message to be retrieved from the destination queue.

System_CAPS_pubpropertyTimeToReachQueue

Gets or sets the time limit for the message to reach the queue.

System_CAPS_pubpropertyTransactionStatusQueue

Gets the transaction status queue on the source computer.

System_CAPS_pubpropertyUseAuthentication

Gets or sets a value that indicates whether the message must be authenticated before being sent.

System_CAPS_pubpropertyUseDeadLetterQueue

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.

System_CAPS_pubpropertyUseEncryption

Gets or sets a value that indicates whether to make the message private.

System_CAPS_pubpropertyUseJournalQueue

Gets or sets a value that indicates whether a copy of the message should be kept in a machine journal on the originating computer.

System_CAPS_pubpropertyUseTracing

Gets or sets a value that indicates whether to trace a message as it moves toward its destination queue.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

You can set default values on selected properties for messages sent to a MessageQueue. DefaultPropertiesToSend is used to specify default property values of the message being sent when objects other than Message instances are sent to a queue, for example, the string argument passed into the Send method in the code fragment, myMessageQueue.Send("hello"). The Message class has corresponding, identically named properties to those in DefaultPropertiesToSend that provide the values when sending a Message instance specifically. Even if you have specified MessageQueue.DefaultPropertiesToSend for a queue, sending a Message object to that queue will cause the values for the identically named Message properties to override the queue's DefaultPropertiesToSend values.

Properties that you do not set explicitly default to the values specified by the constructor, DefaultPropertiesToSend.

For a list of initial property values for an instance of DefaultPropertiesToSend, see the DefaultPropertiesToSend constructor.

The following code example uses the priority of a message to determine default properties to send for the message.

using System;
using System.Messaging;

namespace MyProject
{
	/// <summary>
	/// Provides a container class for the example.
	/// </summary>
	public class MyNewQueue
	{

		//**************************************************
		// Provides an entry point into the application.
		//		 
		// This example specifies different types of default
		// properties for messages.
		//**************************************************

		public static void Main()
		{
			// Create a new instance of the class.
			MyNewQueue myNewQueue = new MyNewQueue();

			// Send normal and high priority messages.
			myNewQueue.SendNormalPriorityMessages();
			myNewQueue.SendHighPriorityMessages();

			return;
		}


		//**************************************************
		// Associates selected message property values
		// with high priority messages.
		//**************************************************

		public void SendHighPriorityMessages()
		{

			// Connect to a message queue.
			MessageQueue myQueue = new 
				MessageQueue(".\\myQueue");

			// Associate selected default property values with high
			// priority messages.
			myQueue.DefaultPropertiesToSend.Priority = 
				MessagePriority.High;
			myQueue.DefaultPropertiesToSend.Label = 
				"High Priority Message";
			myQueue.DefaultPropertiesToSend.Recoverable = true;
			myQueue.DefaultPropertiesToSend.TimeToReachQueue =
				new TimeSpan(0,0,30);

			// Send messages using these defaults.
			myQueue.Send("High priority message data 1.");
			myQueue.Send("High priority message data 2.");
			myQueue.Send("High priority message data 3.");

			return;
		}


		//**************************************************
		// Associates selected message property values
		// with normal priority messages.
		//**************************************************

		public void SendNormalPriorityMessages()
		{

			// Connect to a message queue.
			MessageQueue myQueue = new MessageQueue(".\\myQueue");

			// Associate selected default property values with normal
			// priority messages.
			myQueue.DefaultPropertiesToSend.Priority = 
				MessagePriority.Normal;
			myQueue.DefaultPropertiesToSend.Label = 
				"Normal Priority Message";
			myQueue.DefaultPropertiesToSend.Recoverable = false;
			myQueue.DefaultPropertiesToSend.TimeToReachQueue =
				new TimeSpan(0,2,0);

			// Send messages using these defaults.
			myQueue.Send("Normal priority message data 1.");
			myQueue.Send("Normal priority message data 2.");
			myQueue.Send("Normal priority message data 3.");

			return;
		}
	}
}

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft