MessageQueue MessageQueue MessageQueue MessageQueue Class

定義

提供 Message Queuing 伺服器上的佇列存取。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


        ' References public queues.
        Public Sub SendPublic()

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

            Return

        End Sub


        ' References private queues.
        Public Sub SendPrivate()

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

            Return

        End Sub


        ' References queues by label.
        Public Sub SendByLabel()

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

            Return

        End Sub


        ' 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


        ' 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


        ' 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


        ' 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


        ' 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

End Class

下列程式碼範例會將訊息傳送至佇列, 並使用名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


   
    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


        '
        ' 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


        '
        ' 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

End Class

備註

訊息佇列技術可讓在不同時間執行的應用程式, 在可能暫時離線的異類網路和系統之間進行通訊。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 2000Windows 2000和 Windows NT 的選用元件, 必須另外安裝。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 中 Platform 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)PeekReceive之前, MessageQueue您必須先將類別的新實例與現有佇列產生關聯。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)static成員,因此MessageQueue您可以呼叫它們, 而不需要建立類別的新實例。Unlike 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名稱的其中一個來設定物件的屬性: 易記名稱FormatName Label、或。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 \ Private$屬性MachineName 所\定義的易記名稱適用于\公用佇列, 而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

指定窺視 (Peek) 或接收訊息的方法沒有逾時限制。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

取得或設定訊息佇列用來在網路上傳送公用佇列訊息的基礎優先權 (Base Priority)。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

取得值,指出是否可讀取 MessageQueueGets a value that indicates whether the MessageQueue can be read.

CanWrite CanWrite CanWrite CanWrite

取得值,指出是否可寫入 MessageQueueGets 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

取得包含 IContainerComponentGets 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)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。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)

刪除 Message Queuing 伺服器上的佇列。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)

處置 (Dispose) 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()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。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 的淺層複本 (Shallow Copy)。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 名稱的 StringReturns 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.

另請參閱