MessageQueue MessageQueue MessageQueue MessageQueue Class

定义

提供对“消息队列”服务器上的队列的访问。Provides access to a queue on a Message Queuing server.

public ref class MessageQueue : System::ComponentModel::Component, System::Collections::IEnumerable
[System.ComponentModel.TypeConverter(typeof(System.Messaging.Design.MessageQueueConverter))]
[System.Messaging.MessagingDescription("MessageQueueDesc")]
public class MessageQueue : System.ComponentModel.Component, System.Collections.IEnumerable
type MessageQueue = class
    inherit Component
    interface IEnumerable
Public Class MessageQueue
Inherits Component
Implements IEnumerable
继承
属性
实现

示例

下面的代码示例使用各种MessageQueue路径名称语法类型创建新的对象。The following code example creates new MessageQueue objects using various path name syntax types. 在每种情况下, 它会将消息发送到其路径在构造函数中定义的队列。In each case, it sends a message to the queue whose path is defined in the constructor.

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
ref class MyNewQueue
{
public:

   // References public queues.
   void SendPublic()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );
      myQueue->Send( "Public queue by path name." );
      return;
   }


   // References private queues.
   void SendPrivate()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\Private$\\myQueue" );
      myQueue->Send( "Private queue by path name." );
      return;
   }


   // References queues by label.
   void SendByLabel()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( "Label:TheLabel" );
      myQueue->Send( "Queue by label." );
      return;
   }


   // References queues by format name.
   void SendByFormatName()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( "FormatName:Public=5A5F7535-AE9A-41d4 -935C-845C2AFF7112" );
      myQueue->Send( "Queue by format name." );
      return;
   }


   // References computer journal queues.
   void MonitorComputerJournal()
   {
      MessageQueue^ computerJournal = gcnew MessageQueue( ".\\Journal$" );
      while ( true )
      {
         Message^ journalMessage = computerJournal->Receive();
         
         // Process the journal message.
      }
   }


   // References queue journal queues.
   void MonitorQueueJournal()
   {
      MessageQueue^ queueJournal = gcnew MessageQueue( ".\\myQueue\\Journal$" );
      while ( true )
      {
         Message^ journalMessage = queueJournal->Receive();
         
         // Process the journal message.
      }
   }


   // References dead-letter queues.
   void MonitorDeadLetter()
   {
      MessageQueue^ deadLetter = gcnew MessageQueue( ".\\DeadLetter$" );
      while ( true )
      {
         Message^ deadMessage = deadLetter->Receive();
         
         // Process the dead-letter message.
      }
   }


   // References transactional dead-letter queues.
   void MonitorTransactionalDeadLetter()
   {
      MessageQueue^ TxDeadLetter = gcnew MessageQueue( ".\\XactDeadLetter$" );
      while ( true )
      {
         Message^ txDeadLetter = TxDeadLetter->Receive();
         
         // Process the transactional dead-letter message.
      }
   }

};


//*************************************************
// Provides an entry point into the application.
//         
// This example demonstrates several ways to set
// a queue's path.
//*************************************************
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   myNewQueue->SendPublic();
   myNewQueue->SendPrivate();
   myNewQueue->SendByLabel();
   myNewQueue->SendByFormatName();
   myNewQueue->MonitorComputerJournal();
   myNewQueue->MonitorQueueJournal();
   myNewQueue->MonitorDeadLetter();
   myNewQueue->MonitorTransactionalDeadLetter();
   return 0;
}

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 demonstrates several ways to set
		// a queue's path.
		//**************************************************

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

			myNewQueue.SendPublic();
			myNewQueue.SendPrivate();
			myNewQueue.SendByLabel();
			myNewQueue.SendByFormatName();
			myNewQueue.MonitorComputerJournal();
			myNewQueue.MonitorQueueJournal();
			myNewQueue.MonitorDeadLetter();
			myNewQueue.MonitorTransactionalDeadLetter();

			return;
		}
		
		// References public queues.
		public void SendPublic()
		{
			MessageQueue myQueue = new MessageQueue(".\\myQueue");
			myQueue.Send("Public queue by path name.");

			return;
		}

		// References private queues.
		public void SendPrivate()
		{
			MessageQueue myQueue = new 
				MessageQueue(".\\Private$\\myQueue");
			myQueue.Send("Private queue by path name.");

			return;
		}

		// References queues by label.
		public void SendByLabel()
		{
			MessageQueue myQueue = new MessageQueue("Label:TheLabel");
			myQueue.Send("Queue by label.");

			return;
		}

		// References queues by format name.
		public void SendByFormatName()
		{
			MessageQueue myQueue = new 
				MessageQueue("FormatName:Public=5A5F7535-AE9A-41d4" + 
				"-935C-845C2AFF7112");
			myQueue.Send("Queue by format name.");

			return;
		}

		// References computer journal queues.
		public void MonitorComputerJournal()
		{
			MessageQueue computerJournal = new 
				MessageQueue(".\\Journal$");
			while(true)
			{
				Message journalMessage = computerJournal.Receive();
				// Process the journal message.
			}
		}

		// References queue journal queues.
		public void MonitorQueueJournal()
		{
			MessageQueue queueJournal = new 
				MessageQueue(".\\myQueue\\Journal$");
			while(true)
			{
				Message journalMessage = queueJournal.Receive();
				// Process the journal message.
			}
		}
		
		// References dead-letter queues.
		public void MonitorDeadLetter()
		{
			MessageQueue deadLetter = new 
				MessageQueue(".\\DeadLetter$");
			while(true)
			{
				Message deadMessage = deadLetter.Receive();
				// Process the dead-letter message.
			}
		}

		// References transactional dead-letter queues.
		public void MonitorTransactionalDeadLetter()
		{
			MessageQueue TxDeadLetter = new 
				MessageQueue(".\\XactDeadLetter$");
			while(true)
			{
				Message txDeadLetter = TxDeadLetter.Receive();
				// Process the transactional dead-letter message.
			}
		}

	}
}
Imports System.Messaging

Public Class MyNewQueue


        
        ' Provides an entry point into the application.
        '		 
        ' This example demonstrates several ways to set
        ' a queue's path.
        

        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            myNewQueue.SendPublic()
            myNewQueue.SendPrivate()
            myNewQueue.SendByLabel()
            myNewQueue.SendByFormatName()
            myNewQueue.MonitorComputerJournal()
            myNewQueue.MonitorQueueJournal()
            myNewQueue.MonitorDeadLetter()
            myNewQueue.MonitorTransactionalDeadLetter()

            Return

        End Sub 'Main


        ' References public queues.
        Public Sub SendPublic()

            Dim myQueue As New MessageQueue(".\myQueue")
            myQueue.Send("Public queue by path name.")

            Return

        End Sub 'SendPublic


        ' References private queues.
        Public Sub SendPrivate()

            Dim myQueue As New MessageQueue(".\Private$\myQueue")
            myQueue.Send("Private queue by path name.")

            Return

        End Sub 'SendPrivate


        ' References queues by label.
        Public Sub SendByLabel()

            Dim myQueue As New MessageQueue("Label:TheLabel")
            myQueue.Send("Queue by label.")

            Return

        End Sub 'SendByLabel


        ' References queues by format name.
        Public Sub SendByFormatName()

            Dim myQueue As New _
                MessageQueue("FormatName:Public=" + _
                    "5A5F7535-AE9A-41d4-935C-845C2AFF7112")
            myQueue.Send("Queue by format name.")

            Return

        End Sub 'SendByFormatName


        ' References computer journal queues.
        Public Sub MonitorComputerJournal()

            Dim computerJournal As New MessageQueue(".\Journal$")

            While True

                Dim journalMessage As Message = _
                    computerJournal.Receive()

                ' Process the journal message.

            End While

            Return
        End Sub 'MonitorComputerJournal


        ' References queue journal queues.
        Public Sub MonitorQueueJournal()

            Dim queueJournal As New _
                            MessageQueue(".\myQueue\Journal$")

            While True

                Dim journalMessage As Message = _
                    queueJournal.Receive()

                ' Process the journal message.

            End While

            Return
        End Sub 'MonitorQueueJournal


        ' References dead-letter queues.
        Public Sub MonitorDeadLetter()
            Dim deadLetter As New MessageQueue(".\DeadLetter$")

            While True

                Dim deadMessage As Message = deadLetter.Receive()

                ' Process the dead-letter message.

            End While

            Return

        End Sub 'MonitorDeadLetter


        ' References transactional dead-letter queues.
        Public Sub MonitorTransactionalDeadLetter()

            Dim TxDeadLetter As New MessageQueue(".\XactDeadLetter$")

            While True

                Dim txDeadLetterMessage As Message = _
                    TxDeadLetter.Receive()

                ' Process the transactional dead-letter message.

            End While

            Return

        End Sub 'MonitorTransactionalDeadLetter

End Class 'MyNewQueue 

下面的代码示例使用名Order为的应用程序特定的类向队列发送消息, 并从队列接收消息。The following code example sends a message to a queue, and receives a message from a queue, using an application-specific class called Order.

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;

// This class represents an object the following example 
// sends to a queue and receives from a queue.
ref class Order
{
public:
   int orderId;
   DateTime orderTime;
};


/// <summary>
/// Provides a container class for the example.
/// </summary>
ref class MyNewQueue
{
public:

   //*************************************************
   // Sends an Order to a queue.
   //*************************************************
   void SendMessage()
   {
      // Create a new order and set values.
      Order^ sentOrder = gcnew Order;
      sentOrder->orderId = 3;
      sentOrder->orderTime = DateTime::Now;

      // Connect to a queue on the local computer.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

      // Send the Order to the queue.
      myQueue->Send( sentOrder );
      return;
   }

   //*************************************************
   // Receives a message containing an Order.
   //*************************************************
   void ReceiveMessage()
   {
      // Connect to the a queue on the local computer.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );

      // Set the formatter to indicate body contains an Order.
      array<Type^>^p = gcnew array<Type^>(1);
      p[ 0 ] = Order::typeid;
      myQueue->Formatter = gcnew XmlMessageFormatter( p );
      try
      {
         // Receive and format the message. 
         Message^ myMessage = myQueue->Receive();
         Order^ myOrder = static_cast<Order^>(myMessage->Body);

         // Display message information.
         Console::WriteLine( "Order ID: {0}", myOrder->orderId );
         Console::WriteLine( "Sent: {0}", myOrder->orderTime );
      }
      catch ( MessageQueueException^ ) 
      {
         // Handle Message Queuing exceptions.
      }
      // Handle invalid serialization format.
      catch ( InvalidOperationException^ e ) 
      {
         Console::WriteLine( e->Message );
      }

      // Catch other exceptions as necessary.
      return;
   }
};

//*************************************************
// Provides an entry point into the application.
//         
// This example sends and receives a message from
// a queue.
//*************************************************
int main()
{
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;

   // Send a message to a queue.
   myNewQueue->SendMessage();

   // Receive a message from a queue.
   myNewQueue->ReceiveMessage();
   return 0;
}
using System;
using System.Messaging;

namespace MyProject
{

	// This class represents an object the following example 
	// sends to a queue and receives from a queue.
	public class Order
	{
		public int orderId;
		public DateTime orderTime;
	};	

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

		//**************************************************
		// Provides an entry point into the application.
		//		 
		// This example sends and receives a message from
		// a queue.
		//**************************************************

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

			// Send a message to a queue.
			myNewQueue.SendMessage();

			// Receive a message from a queue.
			myNewQueue.ReceiveMessage();

			return;
		}


		//**************************************************
		// Sends an Order to a queue.
		//**************************************************
		
		public void SendMessage()
		{
			
			// Create a new order and set values.
			Order sentOrder = new Order();
			sentOrder.orderId = 3;
			sentOrder.orderTime = DateTime.Now;

			// Connect to a queue on the local computer.
			MessageQueue myQueue = new MessageQueue(".\\myQueue");

			// Send the Order to the queue.
			myQueue.Send(sentOrder);

			return;
		}


		//**************************************************
		// Receives a message containing an Order.
		//**************************************************
		
		public  void ReceiveMessage()
		{
			// Connect to the a queue on the local computer.
			MessageQueue myQueue = new MessageQueue(".\\myQueue");

			// Set the formatter to indicate body contains an Order.
			myQueue.Formatter = new XmlMessageFormatter(new Type[]
				{typeof(MyProject.Order)});
			
			try
			{
				// Receive and format the message. 
				Message myMessage =	myQueue.Receive(); 
				Order myOrder = (Order)myMessage.Body;

				// Display message information.
				Console.WriteLine("Order ID: " + 
					myOrder.orderId.ToString());
				Console.WriteLine("Sent: " + 
					myOrder.orderTime.ToString());
			}
			
			catch (MessageQueueException)
			{
				// Handle Message Queuing exceptions.
			}

			// Handle invalid serialization format.
			catch (InvalidOperationException e)
			{
				Console.WriteLine(e.Message);
			}
			
			// Catch other exceptions as necessary.

			return;
		}
	}
}
Imports System.Messaging

    ' This class represents an object the following example 
    ' sends to a queue and receives from a queue.
    Public Class Order
        Public orderId As Integer
        Public orderTime As DateTime
    End Class 'Order


   
    Public Class MyNewQueue


        '
        ' Provides an entry point into the application.
        '		 
        ' This example sends and receives a message from
        ' a qeue.
        '

        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            ' Send a message to a queue.
            myNewQueue.SendMessage()

            ' Receive a message from a queue.
            myNewQueue.ReceiveMessage()

            Return

        End Sub 'Main


        '
        ' Sends an Order to a queue.
        '

        Public Sub SendMessage()

            ' Create a new order and set values.
            Dim sentOrder As New Order()
            sentOrder.orderId = 3
            sentOrder.orderTime = DateTime.Now

            ' Connect to a queue on the local computer.
            Dim myQueue As New MessageQueue(".\myQueue")

            ' Send the Order to the queue.
            myQueue.Send(sentOrder)

            Return

        End Sub 'SendMessage


        '
        ' Receives a message containing an Order.
        '

        Public Sub ReceiveMessage()

            ' Connect to the a queue on the local computer.
            Dim myQueue As New MessageQueue(".\myQueue")

            ' Set the formatter to indicate the body contains an Order.
            myQueue.Formatter = New XmlMessageFormatter(New Type() _
                {GetType(Order)})

            Try

                ' Receive and format the message. 
                Dim myMessage As Message = myQueue.Receive()
                Dim myOrder As Order = CType(myMessage.Body, Order)

                ' Display message information.
                Console.WriteLine(("Order ID: " + _
                    myOrder.orderId.ToString()))
                Console.WriteLine(("Sent: " + _
                    myOrder.orderTime.ToString()))

            Catch m As MessageQueueException
                ' Handle Message Queuing exceptions.

            Catch e As InvalidOperationException
                ' Handle invalid serialization format.
                Console.WriteLine(e.Message)


                ' Catch other exceptions as necessary.

            End Try

            Return

        End Sub 'ReceiveMessage

End Class 'MyNewQueue

注解

消息队列技术允许在不同时间运行的应用程序在异类网络和可能暂时脱机的系统之间进行通信。The Message Queuing technology allows applications running at different times to communicate across heterogeneous networks and systems that might be temporarily offline. 应用程序从队列发送、接收或查看 (不删除) 消息。Applications send, receive, or peek (read without removing) messages from queues. 消息队列是和 Windows NT 的Windows 2000Windows 2000可选组件, 并且必须单独安装。Message Queuing is an optional component of Windows 2000Windows 2000 and Windows NT, and must be installed separately.

MessageQueue类是消息队列周围的包装器。The MessageQueue class is a wrapper around Message Queuing. 有多个版本的消息队列, 使用MessageQueue类可能会产生略微不同的行为, 具体取决于所使用的操作系统。There are multiple versions of Message Queuing, and using the MessageQueue class can result in slightly different behavior, depending on the operating system you are using. 有关每个版本的消息队列的特定功能的信息, 请参阅 MSDN 中的平台 SDK 中的 "消息队列新增功能" 主题。For information about specific features of each version of Message Queuing, see the topic "What's New in Message Queuing" in the Platform SDK in MSDN.

MessageQueue类提供对 "消息队列" 队列的引用。The MessageQueue class provides a reference to a Message Queuing queue. 你可以在MessageQueue构造函数中指定一个路径以连接到现有资源, 或者可以在服务器上创建一个新队列。You can specify a path in the MessageQueue constructor to connect to an existing resource, or you can create a new queue on the server. 必须先将Send(Object) MessageQueue类的Peek新实例Receive与现有队列相关联, 然后才能调用、或。Before you can call Send(Object), Peek, or Receive, you must associate the new instance of the MessageQueue class with an existing queue. 此时, 你可以操作队列属性, 例如Category和。 LabelAt that point, you can manipulate the queue properties such as Category and Label.

MessageQueue支持两种类型的消息检索: 同步和异步。MessageQueue supports two types of message retrieval: synchronous and asynchronous. 同步方法PeekReceive将导致进程线程等待指定的时间间隔, 以使新消息到达队列。The synchronous methods, Peek and Receive, cause the process thread to wait a specified time interval for a new message to arrive in the queue. 使用异步方法BeginPeekBeginReceive, 可以在消息到达队列之前, 在单独的线程中继续执行主应用程序任务。The asynchronous methods, BeginPeek and BeginReceive, allow the main application tasks to continue in a separate thread until a message arrives in the queue. 这些方法的工作方式是使用回调对象和状态对象在线程之间传递信息。These methods work by using callback objects and state objects to communicate information between threads.

创建MessageQueue类的新实例时, 不会创建新的 "消息队列" 队列。When you create a new instance of the MessageQueue class, you are not creating a new Message Queuing queue. 相反, 您可以使用Create(String)Delete(String)Purge方法管理服务器上的队列。Instead, you can use the Create(String), Delete(String), and Purge methods to manage queues on the server.

PurgeCreate(String)和是Delete(String) MessageQueue成员不同, 因此你可以在不创建类的新实例的情况下调用它们。 staticUnlike Purge, Create(String) and Delete(String) are static members, so you can call them without creating a new instance of the MessageQueue class.

可以将MessageQueue对象的Path属性设置为以下三个名称之一: 友好名称LabelFormatName或。You can set the MessageQueue object's Path property with one of three names: the friendly name, the FormatName, or the Label. MachineName友好名称由队列的和QueueName MachineName \ \ 属性定义\ , 适用于公用队列, MachineName Private$ QueueName QueueName用于专用队列。The friendly name, which is defined by the queue's MachineName and QueueName properties, is MachineName\QueueName for a public queue, and MachineName\Private$\QueueName for a private queue. FormatName属性允许脱机访问消息队列。The FormatName property allows offline access to message queues. 最后, 可以使用队列的Label属性设置队列的。 PathLastly, you can use the queue's Label property to set the queue's Path.

有关实例MessageQueue的初始属性值的列表, MessageQueue请参见构造函数。For a list of initial property values for an instance of MessageQueue, see the MessageQueue constructor.

构造函数

MessageQueue() MessageQueue() MessageQueue() MessageQueue()

初始化 MessageQueue 类的新实例。Initializes a new instance of the MessageQueue class. 无参数构造函数初始化新实例后,必须设置该实例的 Path 属性才能使用该实例。After the parameterless constructor initializes the new instance, you must set the instance's Path property before you can use the instance.

MessageQueue(String) MessageQueue(String) MessageQueue(String) MessageQueue(String)

初始化 MessageQueue 类的新实例,该实例引用指定路径处的“消息队列”队列。Initializes a new instance of the MessageQueue class that references the Message Queuing queue at the specified path.

MessageQueue(String, Boolean) MessageQueue(String, Boolean) MessageQueue(String, Boolean) MessageQueue(String, Boolean)

初始化 MessageQueue 类的新实例,该实例引用位于指定路径处而且具有指定读访问限制的“消息队列”队列。Initializes a new instance of the MessageQueue class that references the Message Queuing queue at the specified path and with the specified read-access restriction.

MessageQueue(String, Boolean, Boolean) MessageQueue(String, Boolean, Boolean) MessageQueue(String, Boolean, Boolean) MessageQueue(String, Boolean, Boolean)

初始化 MessageQueue 类的新实例。Initializes a new instance of the MessageQueue class.

MessageQueue(String, Boolean, Boolean, QueueAccessMode) MessageQueue(String, Boolean, Boolean, QueueAccessMode) MessageQueue(String, Boolean, Boolean, QueueAccessMode) MessageQueue(String, Boolean, Boolean, QueueAccessMode)

初始化 MessageQueue 类的新实例。Initializes a new instance of the MessageQueue class.

MessageQueue(String, QueueAccessMode) MessageQueue(String, QueueAccessMode) MessageQueue(String, QueueAccessMode) MessageQueue(String, QueueAccessMode)

初始化 MessageQueue 类的新实例。Initializes a new instance of the MessageQueue class.

字段

InfiniteQueueSize InfiniteQueueSize InfiniteQueueSize InfiniteQueueSize

指定对某队列不存在大小限制。Specifies that no size restriction exists for a queue.

InfiniteTimeout InfiniteTimeout InfiniteTimeout InfiniteTimeout

指定对查看或接收消息的方法不存在超时设定。Specifies that no time-out exists for methods that peek or receive messages.

属性

AccessMode AccessMode AccessMode AccessMode

获取一个值,该值指示队列的访问模式。Gets a value that indicates the access mode for the queue.

Authenticate Authenticate Authenticate Authenticate

获取或设置一个值,该值指示队列是否仅接受经过身份验证的消息。Gets or sets a value that indicates whether the queue accepts only authenticated messages.

BasePriority BasePriority BasePriority BasePriority

获取或设置基优先级,“消息队列”使用该基优先级在网络上传送公共队列的消息。Gets or sets the base priority Message Queuing uses to route a public queue's messages over the network.

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

获取一个指示组件是否可以引发事件的值。Gets a value indicating whether the component can raise an event.

(Inherited from Component)
CanRead CanRead CanRead CanRead

获取一个值,该值指示 MessageQueue 是否可读。Gets a value that indicates whether the MessageQueue can be read.

CanWrite CanWrite CanWrite CanWrite

获取一个值,该值指示 MessageQueue 是否可写。Gets a value that indicates whether the MessageQueue can be written to.

Category Category Category Category

获取或设置队列类别。Gets or sets the queue category.

Container Container Container Container

获取 IContainer,它包含 ComponentGets the IContainer that contains the Component.

(Inherited from Component)
CreateTime CreateTime CreateTime CreateTime

获取在“消息队列”中创建队列的时间和日期。Gets the time and date that the queue was created in Message Queuing.

DefaultPropertiesToSend DefaultPropertiesToSend DefaultPropertiesToSend DefaultPropertiesToSend

获取或设置(当应用程序向队列发送消息时)默认情况下使用的消息属性值。Gets or sets the message property values to be used by default when the application sends messages to the queue.

DenySharedReceive DenySharedReceive DenySharedReceive DenySharedReceive

获取或设置一个值,该值指示此 MessageQueue 对来自“消息队列”队列的消息是否有独占接收访问权。Gets or sets a value that indicates whether this MessageQueue has exclusive access to receive messages from the Message Queuing queue.

DesignMode DesignMode DesignMode DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
EnableConnectionCache EnableConnectionCache EnableConnectionCache EnableConnectionCache

获取或设置一个值,该值指示应用程序是否维护连接缓存。Gets or sets a value that indicates whether a cache of connections will be maintained by the application.

EncryptionRequired EncryptionRequired EncryptionRequired EncryptionRequired

获取或设置一个指示队列是否只接受非私有(非加密)消息的值。Gets or sets a value that indicates whether the queue accepts only non-private (non-encrypted) messages.

Events Events Events Events

获取附加到此 Component 的事件处理程序的列表。Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
FormatName FormatName FormatName FormatName

获取“消息队列”在创建队列时生成的唯一队列名。Gets the unique queue name that Message Queuing generated at the time of the queue's creation.

Formatter Formatter Formatter Formatter

获取或设置格式化程序,该格式化程序用于将对象序列化为从队列读取或写入队列的消息体,或者用于将从队列读取或写入队列的消息体反序列化为对象。Gets or sets the formatter used to serialize an object into or deserialize an object from the body of a message read from or written to the queue.

Id Id Id Id

获取队列的唯一“消息队列”标识符。Gets the unique Message Queuing identifier of the queue.

Label Label Label Label

获取或设置队列说明。Gets or sets the queue description.

LastModifyTime LastModifyTime LastModifyTime LastModifyTime

获取队列属性的最近修改时间。Gets the last time the properties of a queue were modified.

MachineName MachineName MachineName MachineName

获取或设置“消息队列”队列所在的计算机的名称。Gets or sets the name of the computer where the Message Queuing queue is located.

MaximumJournalSize MaximumJournalSize MaximumJournalSize MaximumJournalSize

获取或设置日记队列的最大大小。Gets or sets the maximum size of the journal queue.

MaximumQueueSize MaximumQueueSize MaximumQueueSize MaximumQueueSize

获取或设置队列的最大大小。Gets or sets the maximum size of the queue.

MessageReadPropertyFilter MessageReadPropertyFilter MessageReadPropertyFilter MessageReadPropertyFilter

获取或设置接收或查看消息的属性筛选器。Gets or sets the property filter for receiving or peeking messages.

MulticastAddress MulticastAddress MulticastAddress MulticastAddress

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 获取或设置与队列关联的多路广播地址。Gets or sets the multicast address associated with the queue.

Path Path Path Path

获取或设置队列的路径。Gets or sets the queue's path. 设置 Path 会导致 MessageQueue 指向新队列。Setting the Path causes the MessageQueue to point to a new queue.

QueueName QueueName QueueName QueueName

获取或设置标识队列的友好名称。Gets or sets the friendly name that identifies the queue.

ReadHandle ReadHandle ReadHandle ReadHandle

获取用于从消息队列读取消息的本机句柄。Gets the native handle used to read messages from the message queue.

Site Site Site Site

获取或设置 ComponentISiteGets or sets the ISite of the Component.

(Inherited from Component)
SynchronizingObject SynchronizingObject SynchronizingObject SynchronizingObject

获取或设置由 ReceiveCompletedPeekCompleted 事件产生封送事件处理程序调用的对象。Gets or sets the object that marshals the event-handler call resulting from a ReceiveCompleted or PeekCompleted event.

Transactional Transactional Transactional Transactional

获取一个值,该值指示队列是否只接受事务。Gets a value that indicates whether the queue accepts only transactions.

UseJournalQueue UseJournalQueue UseJournalQueue UseJournalQueue

获取或设置一个值,该值指示接收的消息是否复制到日记队列。Gets or sets a value that indicates whether received messages are copied to the journal queue.

WriteHandle WriteHandle WriteHandle WriteHandle

获取用于将消息发送到消息队列的本机句柄。Gets the native handle used to send messages to the message queue.

方法

BeginPeek() BeginPeek() BeginPeek() BeginPeek()

启动一个没有超时设定的异步查看操作。直到队列中出现消息时,才完成此操作。Initiates an asynchronous peek operation that has no time-out. The operation is not complete until a message becomes available in the queue.

BeginPeek(TimeSpan) BeginPeek(TimeSpan) BeginPeek(TimeSpan) BeginPeek(TimeSpan)

启动一个具有指定超时设定的异步查看操作。直到队列中出现消息时或发生超时时才完成操作。Initiates an asynchronous peek operation that has a specified time-out. The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginPeek(TimeSpan, Cursor, PeekAction, Object, AsyncCallback) BeginPeek(TimeSpan, Cursor, PeekAction, Object, AsyncCallback) BeginPeek(TimeSpan, Cursor, PeekAction, Object, AsyncCallback) BeginPeek(TimeSpan, Cursor, PeekAction, Object, AsyncCallback)

启动异步查看操作,此操作具有指定的超时并使用指定的游标、指定的查看操作和指定的状态对象。Initiates an asynchronous peek operation that has a specified time-out and that uses a specified cursor, a specified peek action, and a specified state object. 状态对象在操作的整个生存期内提供相关的信息。The state object provides associated information throughout the lifetime of the operation. 此重载通过回调接收操作的事件处理程序标识的通知。This overload receives notification, through a callback, of the identity of the event handler for the operation. 直到队列中出现消息时或发生超时时才完成操作。The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginPeek(TimeSpan, Object) BeginPeek(TimeSpan, Object) BeginPeek(TimeSpan, Object) BeginPeek(TimeSpan, Object)

启动具有指定超时设定和指定状态对象的异步查看操作,此状态对象在操作的整个生存期内提供相关信息。Initiates an asynchronous peek operation that has a specified time-out and a specified state object, which provides associated information throughout the operation's lifetime. 直到队列中出现消息时或发生超时时才完成操作。The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginPeek(TimeSpan, Object, AsyncCallback) BeginPeek(TimeSpan, Object, AsyncCallback) BeginPeek(TimeSpan, Object, AsyncCallback) BeginPeek(TimeSpan, Object, AsyncCallback)

启动具有指定超时设定和指定状态对象的异步查看操作,此状态对象在操作的整个生存期内提供相关信息。Initiates an asynchronous peek operation that has a specified time-out and a specified state object, which provides associated information throughout the operation's lifetime. 此重载通过回调接收操作的事件处理程序标识的通知。This overload receives notification, through a callback, of the identity of the event handler for the operation. 直到队列中出现消息时或发生超时时才完成操作。The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginReceive() BeginReceive() BeginReceive() BeginReceive()

启动一个没有超时设定的异步接收操作。直到队列中出现消息时,才完成此操作。Initiates an asynchronous receive operation that has no time-out. The operation is not complete until a message becomes available in the queue.

BeginReceive(TimeSpan) BeginReceive(TimeSpan) BeginReceive(TimeSpan) BeginReceive(TimeSpan)

启动具有指定超时设定的异步接收操作。直到队列中出现消息时或发生超时时才完成操作。Initiates an asynchronous receive operation that has a specified time-out. The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginReceive(TimeSpan, Cursor, Object, AsyncCallback) BeginReceive(TimeSpan, Cursor, Object, AsyncCallback) BeginReceive(TimeSpan, Cursor, Object, AsyncCallback) BeginReceive(TimeSpan, Cursor, Object, AsyncCallback)

启动异步接收操作,此操作具有指定的超时并使用指定的游标和指定的状态对象。Initiates an asynchronous receive operation that has a specified time-out and uses a specified cursor and a specified state object. 状态对象在操作的整个生存期内提供相关的信息。The state object provides associated information throughout the lifetime of the operation. 此重载通过回调接收操作的事件处理程序标识的通知。This overload receives notification, through a callback, of the identity of the event handler for the operation. 直到队列中出现消息时或发生超时时才完成操作。The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginReceive(TimeSpan, Object) BeginReceive(TimeSpan, Object) BeginReceive(TimeSpan, Object) BeginReceive(TimeSpan, Object)

启动具有指定超时设定和指定状态对象的异步接收操作,此状态对象在操作的整个生存期内提供相关信息。Initiates an asynchronous receive operation that has a specified time-out and a specified state object, which provides associated information throughout the operation's lifetime. 直到队列中出现消息时或发生超时时才完成操作。The operation is not complete until either a message becomes available in the queue or the time-out occurs.

BeginReceive(TimeSpan, Object, AsyncCallback) BeginReceive(TimeSpan, Object, AsyncCallback) BeginReceive(TimeSpan, Object, AsyncCallback) BeginReceive(TimeSpan, Object, AsyncCallback)

启动具有指定超时设定和指定状态对象的异步接收操作,此状态对象在操作的整个生存期内提供相关信息。Initiates an asynchronous receive operation that has a specified time-out and a specified state object, which provides associated information throughout the operation's lifetime. 此重载通过回调接收操作的事件处理程序标识的通知。This overload receives notification, through a callback, of the identity of the event handler for the operation. 直到队列中出现消息时或发生超时时才完成操作。The operation is not complete until either a message becomes available in the queue or the time-out occurs.

ClearConnectionCache() ClearConnectionCache() ClearConnectionCache() ClearConnectionCache()

清除连接缓存。Clears the connection cache.

Close() Close() Close() Close()

释放 MessageQueue 分配的所有资源。Frees all resources allocated by the MessageQueue.

Create(String) Create(String) Create(String) Create(String)

在指定的路径中创建非事务性“消息队列”队列。Creates a non-transactional Message Queuing queue at the specified path.

Create(String, Boolean) Create(String, Boolean) Create(String, Boolean) Create(String, Boolean)

在指定的路径中创建事务性或非事务性“消息队列”队列。Creates a transactional or non-transactional Message Queuing queue at the specified path.

CreateCursor() CreateCursor() CreateCursor() CreateCursor()

为当前消息队列创建新的 CursorCreates a new Cursor for the current message queue.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Delete(String) Delete(String) Delete(String) Delete(String)

删除“消息队列”服务器上的队列。Deletes a queue on a Message Queuing server.

Dispose() Dispose() Dispose() Dispose()

释放由 Component 使用的所有资源。Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

处置由 MessageQueue 占用的资源(内存除外)。Disposes of the resources (other than memory) used by the MessageQueue.

EndPeek(IAsyncResult) EndPeek(IAsyncResult) EndPeek(IAsyncResult) EndPeek(IAsyncResult)

完成指定的异步查看操作。Completes the specified asynchronous peek operation.

EndReceive(IAsyncResult) EndReceive(IAsyncResult) EndReceive(IAsyncResult) EndReceive(IAsyncResult)

完成指定的异步接收操作。Completes the specified asynchronous receive operation.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Exists(String) Exists(String) Exists(String) Exists(String)

确定指定的路径中是否存在“消息队列”队列。Determines whether a Message Queuing queue exists at the specified path.

GetAllMessages() GetAllMessages() GetAllMessages() GetAllMessages()

返回位于队列中的所有消息。Returns all the messages that are in the queue.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

枚举队列中的消息。Enumerates the messages in a queue. GetEnumerator() 已弃用。GetEnumerator() is deprecated. 应改用 GetMessageEnumerator2()GetMessageEnumerator2() should be used instead.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetMachineId(String) GetMachineId(String) GetMachineId(String) GetMachineId(String)

获取计算机的标识符,此 MessageQueue 引用的队列位于该计算机上。Gets the identifier of the computer on which the queue referenced by this MessageQueue is located.

GetMessageEnumerator() GetMessageEnumerator() GetMessageEnumerator() GetMessageEnumerator()

为队列中的所有消息创建枚举数对象。Creates an enumerator object for all the messages in the queue. GetMessageEnumerator() 已弃用。GetMessageEnumerator() is deprecated. 应改用 GetMessageEnumerator2()GetMessageEnumerator2() should be used instead.

GetMessageEnumerator2() GetMessageEnumerator2() GetMessageEnumerator2() GetMessageEnumerator2()

为队列中的所有消息创建枚举数对象。Creates an enumerator object for all the messages in the queue.

GetMessageQueueEnumerator() GetMessageQueueEnumerator() GetMessageQueueEnumerator() GetMessageQueueEnumerator()

提供只进游标语义,以枚举网络上的所有公共队列。Provides forward-only cursor semantics to enumerate through all public queues on the network.

GetMessageQueueEnumerator(MessageQueueCriteria) GetMessageQueueEnumerator(MessageQueueCriteria) GetMessageQueueEnumerator(MessageQueueCriteria) GetMessageQueueEnumerator(MessageQueueCriteria)

提供只进游标语义,以枚举网络上满足指定判据的所有公共队列。Provides forward-only cursor semantics to enumerate through all public queues on the network that meet the specified criteria.

GetPrivateQueuesByMachine(String) GetPrivateQueuesByMachine(String) GetPrivateQueuesByMachine(String) GetPrivateQueuesByMachine(String)

检索指定计算机上的所有专用队列。Retrieves all the private queues on the specified computer.

GetPublicQueues() GetPublicQueues() GetPublicQueues() GetPublicQueues()

检索网络上的所有公共队列。Retrieves all the public queues on the network.

GetPublicQueues(MessageQueueCriteria) GetPublicQueues(MessageQueueCriteria) GetPublicQueues(MessageQueueCriteria) GetPublicQueues(MessageQueueCriteria)

检索网络上满足指定判据的所有公共队列。Retrieves all the public queues on the network that meet the specified criteria.

GetPublicQueuesByCategory(Guid) GetPublicQueuesByCategory(Guid) GetPublicQueuesByCategory(Guid) GetPublicQueuesByCategory(Guid)

检索网络上所有属于指定类别的公共队列。Retrieves all the public queues on the network that belong to the specified category.

GetPublicQueuesByLabel(String) GetPublicQueuesByLabel(String) GetPublicQueuesByLabel(String) GetPublicQueuesByLabel(String)

检索网络上带有指定标签的所有公共队列。Retrieves all the public queues on the network that carry the specified label.

GetPublicQueuesByMachine(String) GetPublicQueuesByMachine(String) GetPublicQueuesByMachine(String) GetPublicQueuesByMachine(String)

检索驻留在指定计算机上的所有公共队列。Retrieves all the public queues that reside on the specified computer.

GetSecurityContext() GetSecurityContext() GetSecurityContext() GetSecurityContext()

检索进行此调用时 MSMQ 将当前用户(线程标识)关联到的安全上下文。Retrieves the security context that MSMQ associates with the current user (thread identity) at the time of this call.

GetService(Type) GetService(Type) GetService(Type) GetService(Type)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
Peek() Peek() Peek() Peek()

返回但不移除(查看)此 MessageQueue 所引用的队列中的第一条消息。Returns without removing (peeks) the first message in the queue referenced by this MessageQueue. Peek() 方法是同步的,所以在有可用消息前,该方法阻塞当前线程。The Peek() method is synchronous, so it blocks the current thread until a message becomes available.

Peek(TimeSpan) Peek(TimeSpan) Peek(TimeSpan) Peek(TimeSpan)

返回但不移除(查看)此 MessageQueue 所引用的队列中的第一条消息。Returns without removing (peeks) the first message in the queue referenced by this MessageQueue. Peek() 方法是同步的,因此在有可用消息或发生指定的超时之前,它一直阻止当前线程。The Peek() method is synchronous, so it blocks the current thread until a message becomes available or the specified time-out occurs.

Peek(TimeSpan, Cursor, PeekAction) Peek(TimeSpan, Cursor, PeekAction) Peek(TimeSpan, Cursor, PeekAction) Peek(TimeSpan, Cursor, PeekAction)

使用指定的游标返回但不移除(查看)队列中的当前消息或下一条消息。Returns without removing (peeks) the current or next message in the queue, using the specified cursor. Peek() 方法是同步的,因此在有可用消息或发生指定的超时之前,它一直阻止当前线程。The Peek() method is synchronous, so it blocks the current thread until a message becomes available or the specified time-out occurs.

PeekByCorrelationId(String) PeekByCorrelationId(String) PeekByCorrelationId(String) PeekByCorrelationId(String)

查看匹配给定相关标识符的消息,而且在队列中当前不存在具有指定相关标识符的消息时,立即引发异常。Peeks the message that matches the given correlation identifier and immediately raises an exception if no message with the specified correlation identifier currently exists in the queue.

PeekByCorrelationId(String, TimeSpan) PeekByCorrelationId(String, TimeSpan) PeekByCorrelationId(String, TimeSpan) PeekByCorrelationId(String, TimeSpan)

查看匹配给定相关标识符的消息,并且一直等到队列中出现具有指定相关标识符的消息或超时过期时。Peeks the message that matches the given correlation identifier and waits until either a message with the specified correlation identifier is available in the queue, or the time-out expires.

PeekById(String) PeekById(String) PeekById(String) PeekById(String)

查看其消息标识符匹配 id 参数的消息。Peeks the message whose message identifier matches the id parameter.

PeekById(String, TimeSpan) PeekById(String, TimeSpan) PeekById(String, TimeSpan) PeekById(String, TimeSpan)

查看其消息标识符匹配 id 参数的消息。Peeks the message whose message identifier matches the id parameter. 一直等到队列中出现该消息或发生超时。Waits until the message appears in the queue or a time-out occurs.

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.

Purge() Purge() Purge() Purge()

删除队列中包含的所有消息。Deletes all the messages contained in the queue.

Receive() Receive() Receive() Receive()

接收 MessageQueue 引用的队列中可用的第一条消息。Receives the first message available in the queue referenced by the MessageQueue. 此调用是同步的,在有可用消息前,它将一直阻止当前线程的执行。This call is synchronous, and blocks the current thread of execution until a message is available.

Receive(MessageQueueTransaction) Receive(MessageQueueTransaction) Receive(MessageQueueTransaction) Receive(MessageQueueTransaction)

接收 MessageQueue 引用的事务性队列中可用的第一条消息。Receives the first message available in the transactional queue referenced by the MessageQueue. 此调用是同步的,在有可用消息前,它将一直阻止当前线程的执行。This call is synchronous, and blocks the current thread of execution until a message is available.

Receive(MessageQueueTransactionType) Receive(MessageQueueTransactionType) Receive(MessageQueueTransactionType) Receive(MessageQueueTransactionType)

接收 MessageQueue 引用的队列中可用的第一条消息。Receives the first message available in the queue referenced by the MessageQueue. 此调用是同步的,在有可用消息前,它将一直阻止当前线程的执行。This call is synchronous, and blocks the current thread of execution until a message is available.

Receive(TimeSpan) Receive(TimeSpan) Receive(TimeSpan) Receive(TimeSpan)

接收由 MessageQueue 引用的队列中的第一条可用消息,并且一直等到队列中有可用消息或超时过期。Receives the first message available in the queue referenced by the MessageQueue and waits until either a message is available in the queue, or the time-out expires.

Receive(TimeSpan, Cursor) Receive(TimeSpan, Cursor) Receive(TimeSpan, Cursor) Receive(TimeSpan, Cursor)

使用指定的游标接收队列中的当前消息。Receives the current message in the queue, using a specified cursor. 如果没有可用的消息,此方法将等待,直到有可用的消息或超时到期为止。If no message is available, this method waits until either a message is available, or the time-out expires.

Receive(TimeSpan, Cursor, MessageQueueTransaction) Receive(TimeSpan, Cursor, MessageQueueTransaction) Receive(TimeSpan, Cursor, MessageQueueTransaction) Receive(TimeSpan, Cursor, MessageQueueTransaction)

使用指定的游标接收队列中的当前消息。Receives the current message in the queue, using a specified cursor. 如果没有可用的消息,此方法将等待,直到有可用的消息或超时到期为止。If no message is available, this method waits until either a message is available, or the time-out expires.

Receive(TimeSpan, Cursor, MessageQueueTransactionType) Receive(TimeSpan, Cursor, MessageQueueTransactionType) Receive(TimeSpan, Cursor, MessageQueueTransactionType) Receive(TimeSpan, Cursor, MessageQueueTransactionType)

使用指定的游标接收队列中的当前消息。Receives the current message in the queue, using a specified cursor. 如果没有可用的消息,此方法将等待,直到有可用的消息或超时到期为止。If no message is available, this method waits until either a message is available, or the time-out expires.

Receive(TimeSpan, MessageQueueTransaction) Receive(TimeSpan, MessageQueueTransaction) Receive(TimeSpan, MessageQueueTransaction) Receive(TimeSpan, MessageQueueTransaction)

接收由 MessageQueue 引用的事务性队列中的第一条可用消息,并且一直等到队列中有可用消息或超时过期。Receives the first message available in the transactional queue referenced by the MessageQueue and waits until either a message is available in the queue, or the time-out expires.

Receive(TimeSpan, MessageQueueTransactionType) Receive(TimeSpan, MessageQueueTransactionType) Receive(TimeSpan, MessageQueueTransactionType) Receive(TimeSpan, MessageQueueTransactionType)

接收 MessageQueue 引用的队列中可用的第一条消息。Receives the first message available in the queue referenced by the MessageQueue. 此调用是同步的,并且一直等到队列中有可用的消息或超时到期。This call is synchronous, and waits until either a message is available in the queue, or the time-out expires.

ReceiveByCorrelationId(String) ReceiveByCorrelationId(String) ReceiveByCorrelationId(String) ReceiveByCorrelationId(String)

从非事务性队列中接收与给定的相关标识符匹配的消息,而且在队列中当前不存在具有指定相关标识符的消息时立即引发异常。Receives the message that matches the given correlation identifier (from a non-transactional queue) and immediately raises an exception if no message with the specified correlation identifier currently exists in the queue.

ReceiveByCorrelationId(String, MessageQueueTransaction) ReceiveByCorrelationId(String, MessageQueueTransaction) ReceiveByCorrelationId(String, MessageQueueTransaction) ReceiveByCorrelationId(String, MessageQueueTransaction)

从事务性队列中接收与给定的相关标识符匹配的消息,而且在队列中当前不存在具有指定相关标识符的消息时立即引发异常。Receives the message that matches the given correlation identifier (from a transactional queue) and immediately raises an exception if no message with the specified correlation identifier currently exists in the queue.

ReceiveByCorrelationId(String, MessageQueueTransactionType) ReceiveByCorrelationId(String, MessageQueueTransactionType) ReceiveByCorrelationId(String, MessageQueueTransactionType) ReceiveByCorrelationId(String, MessageQueueTransactionType)

接收匹配给定相关标识符的消息,而且在队列中当前不存在具有指定相关标识符的消息时立即引发异常。Receives the message that matches the given correlation identifier and immediately raises an exception if no message with the specified correlation identifier currently exists in the queue.

ReceiveByCorrelationId(String, TimeSpan) ReceiveByCorrelationId(String, TimeSpan) ReceiveByCorrelationId(String, TimeSpan) ReceiveByCorrelationId(String, TimeSpan)

从非事务性队列中接收与给定的相关标识符匹配的消息,并且一直等到队列中出现具有指定相关标识符的消息或者超时过期。Receives the message that matches the given correlation identifier (from a non-transactional queue) and waits until either a message with the specified correlation identifier is available in the queue, or the time-out expires.

ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransaction) ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransaction) ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransaction) ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransaction)

从事务性队列中接收与给定的相关标识符匹配的消息,并且一直等到队列中出现具有指定相关标识符的消息或者超时过期。Receives the message that matches the given correlation identifier (from a transactional queue) and waits until either a message with the specified correlation identifier is available in the queue, or the time-out expires.

ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransactionType) ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransactionType) ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransactionType) ReceiveByCorrelationId(String, TimeSpan, MessageQueueTransactionType)

接收与给定的相关标识符匹配的消息,并且一直等到队列中出现具有指定相关标识符的消息或超时过期。Receives the message that matches the given correlation identifier and waits until either a message with the specified correlation identifier is available in the queue, or the time-out expires.

ReceiveById(String) ReceiveById(String) ReceiveById(String) ReceiveById(String)

从非事务性队列中接收与给定的标识符匹配的消息,而且在队列中当前不存在具有指定标识符的消息时立即引发异常。Receives the message that matches the given identifier from a non-transactional queue and immediately raises an exception if no message with the specified identifier currently exists in the queue.

ReceiveById(String, MessageQueueTransaction) ReceiveById(String, MessageQueueTransaction) ReceiveById(String, MessageQueueTransaction) ReceiveById(String, MessageQueueTransaction)

从事务性队列中接收与给定的标识符匹配的消息,而且在队列中当前不存在具有指定标识符的消息时立即引发异常。Receives the message that matches the given identifier (from a transactional queue) and immediately raises an exception if no message with the specified identifier currently exists in the queue.

ReceiveById(String, MessageQueueTransactionType) ReceiveById(String, MessageQueueTransactionType) ReceiveById(String, MessageQueueTransactionType) ReceiveById(String, MessageQueueTransactionType)

接收与给定的标识符匹配的消息,而且在队列中当前不存在具有指定标识符的消息时立即引发异常。Receives the message that matches the given identifier and immediately raises an exception if no message with the specified identifier currently exists in the queue.

ReceiveById(String, TimeSpan) ReceiveById(String, TimeSpan) ReceiveById(String, TimeSpan) ReceiveById(String, TimeSpan)

从非事务性队列接收与给定的标识符匹配的消息,并且一直等到队列中出现具有指定标识符的消息或超时过期。Receives the message that matches the given identifier (from a non-transactional queue) and waits until either a message with the specified identifier is available in the queue or the time-out expires.

ReceiveById(String, TimeSpan, MessageQueueTransaction) ReceiveById(String, TimeSpan, MessageQueueTransaction) ReceiveById(String, TimeSpan, MessageQueueTransaction) ReceiveById(String, TimeSpan, MessageQueueTransaction)

从事务性队列接收与给定的标识符匹配的消息,并且一直等到队列中出现具有指定标识符的消息或超时过期。Receives the message that matches the given identifier (from a transactional queue) and waits until either a message with the specified identifier is available in the queue or the time-out expires.

ReceiveById(String, TimeSpan, MessageQueueTransactionType) ReceiveById(String, TimeSpan, MessageQueueTransactionType) ReceiveById(String, TimeSpan, MessageQueueTransactionType) ReceiveById(String, TimeSpan, MessageQueueTransactionType)

接收与给定的标识符匹配的消息,并且一直等到队列中出现具有指定标识符的消息或超时过期。Receives the message that matches the given identifier and waits until either a message with the specified identifier is available in the queue or the time-out expires.

ReceiveByLookupId(Int64) ReceiveByLookupId(Int64) ReceiveByLookupId(Int64) ReceiveByLookupId(Int64)

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

ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransaction) ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransaction) ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransaction) ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransaction)

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

ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransactionType) ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransactionType) ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransactionType) ReceiveByLookupId(MessageLookupAction, Int64, MessageQueueTransactionType)

在 MSMQ 3.0 中引入。Introduced in MSMQ 3.0. 使用指定的事务上下文从队列中接收特定的消息。Receives a specific message from the queue, using the specified transaction context. 消息可通过查询标识符来指定,也可以通过其相对于队首或队尾的位置来指定。The message can be specified by a lookup identifier or by its position at the front or end of the queue.

Refresh() Refresh() Refresh() Refresh()

刷新 MessageQueue 所显示的属性以反映资源的当前状态。Refreshes the properties presented by the MessageQueue to reflect the current state of the resource.

ResetPermissions() ResetPermissions() ResetPermissions() ResetPermissions()

将权限列表重置为操作系统的默认值。Resets the permission list to the operating system's default values. 移除已追加到默认列表中的所有队列权限。Removes any queue permissions you have appended to the default list.

Send(Object) Send(Object) Send(Object) Send(Object)

将对象发送到此 MessageQueue 引用的非事务性队列。Sends an object to non-transactional queue referenced by this MessageQueue.

Send(Object, MessageQueueTransaction) Send(Object, MessageQueueTransaction) Send(Object, MessageQueueTransaction) Send(Object, MessageQueueTransaction)

将对象发送到此 MessageQueue 所引用的事务性队列。Sends an object to the transactional queue referenced by this MessageQueue.

Send(Object, MessageQueueTransactionType) Send(Object, MessageQueueTransactionType) Send(Object, MessageQueueTransactionType) Send(Object, MessageQueueTransactionType)

将对象发送到此 MessageQueue 所引用的队列。Sends an object to the queue referenced by this MessageQueue.

Send(Object, String) Send(Object, String) Send(Object, String) Send(Object, String)

将对象发送到此 MessageQueue 引用的非事务性队列,并指定消息的标签。Sends an object to the non-transactional queue referenced by this MessageQueue and specifies a label for the message.

Send(Object, String, MessageQueueTransaction) Send(Object, String, MessageQueueTransaction) Send(Object, String, MessageQueueTransaction) Send(Object, String, MessageQueueTransaction)

将对象发送到此 MessageQueue 引用的事务性队列中,并指定该消息的标签。Sends an object to the transactional queue referenced by this MessageQueue and specifies a label for the message.

Send(Object, String, MessageQueueTransactionType) Send(Object, String, MessageQueueTransactionType) Send(Object, String, MessageQueueTransactionType) Send(Object, String, MessageQueueTransactionType)

将对象发送到此 MessageQueue 引用的队列中,并指定该消息的标签。Sends an object to the queue referenced by this MessageQueue and specifies a label for the message.

SetPermissions(AccessControlList) SetPermissions(AccessControlList) SetPermissions(AccessControlList) SetPermissions(AccessControlList)

基于访问控制列表的内容将访问权限分配给队列。Assigns access rights to the queue based on the contents of an access control list.

SetPermissions(MessageQueueAccessControlEntry) SetPermissions(MessageQueueAccessControlEntry) SetPermissions(MessageQueueAccessControlEntry) SetPermissions(MessageQueueAccessControlEntry)

基于访问控制项的内容将访问权限分配给队列。Assigns access rights to the queue based on the contents of an access control entry.

SetPermissions(String, MessageQueueAccessRights) SetPermissions(String, MessageQueueAccessRights) SetPermissions(String, MessageQueueAccessRights) SetPermissions(String, MessageQueueAccessRights)

给予计算机、组或用户指定的访问权限。Gives a computer, group, or user the specified access rights.

SetPermissions(String, MessageQueueAccessRights, AccessControlEntryType) SetPermissions(String, MessageQueueAccessRights, AccessControlEntryType) SetPermissions(String, MessageQueueAccessRights, AccessControlEntryType) SetPermissions(String, MessageQueueAccessRights, AccessControlEntryType)

利用指定的访问控制类型(允许、拒绝、撤消或设置),给予计算机、组或用户指定的访问权限。Gives a computer, group, or user the specified access rights, with the specified access control type (allow, deny, revoke, or set).

ToString() ToString() ToString() ToString()

返回包含 Component 的名称的 String(如果有)。Returns a String containing the name of the Component, if any. 不应重写此方法。This method should not be overridden.

(Inherited from Component)

事件

Disposed Disposed Disposed Disposed

当通过调用 Dispose() 方法释放组件时发生。Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)
PeekCompleted PeekCompleted PeekCompleted PeekCompleted

在消息未从队列移除的情况下读取该消息时发生。Occurs when a message is read without being removed from the queue. 这是异步操作 BeginPeek() 的结果。This is a result of the asynchronous operation, BeginPeek().

ReceiveCompleted ReceiveCompleted ReceiveCompleted ReceiveCompleted

在从队列移除某条消息后发生。Occurs when a message has been removed from the queue. 此事件由异步操作 BeginReceive() 引发。This event is raised by the asynchronous operation, BeginReceive().

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

线程安全性

只有方法GetAllMessages()是线程安全的。Only the GetAllMessages() method is thread safe.

另请参阅