MessageQueue コンストラクター

定義

MessageQueue クラスの新しいインスタンスを初期化します。

オーバーロード

MessageQueue()

MessageQueue クラスの新しいインスタンスを初期化します。 パラメーターなしのコンストラクターが新しいインスタンスを初期化した後、そのインスタンスを使用する前にインスタンスの Path プロパティを設定する必要があります。

MessageQueue(String)

指定したパスのメッセージ キューのキューを参照する MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, Boolean)

指定した読み取りアクセス制限を持つ指定したパスのメッセージ キューのキューを参照する MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, Boolean, Boolean)

MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, Boolean, Boolean, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue()

MessageQueue クラスの新しいインスタンスを初期化します。 パラメーターなしのコンストラクターが新しいインスタンスを初期化した後、そのインスタンスを使用する前にインスタンスの Path プロパティを設定する必要があります。

public:
 MessageQueue();
public MessageQueue ();
Public Sub New ()

次のコード例では、新しい MessageQueue を作成します。

// Connect to a queue on the local computer. You must set the queue's
// Path property before you can use the queue.
MessageQueue queue = new MessageQueue();
queue.Path = ".\\exampleQueue";

注釈

このオーバーロードを使用して、メッセージ キュー サーバー上の MessageQueue キューにすぐに関連付けられていない クラスの新しいインスタンスを作成します。 このインスタンスを使用する前に、 プロパティを設定して既存のメッセージ キュー キューに接続する Path 必要があります。 または、メソッドの MessageQueue 戻り値への参照を Create(String) 設定して、新しいメッセージ キューキューを作成することもできます。

コンストラクターは MessageQueue 、 クラスの新しいインスタンスを MessageQueue インスタンス化します。新しいメッセージ キュー キューは作成されません。

のインスタンスの初期プロパティ値を次の MessageQueue表に示します。

プロパティ 初期値
DefaultPropertiesToSend クラスのパラメーターなしのコンストラクターによって設定される DefaultPropertiesToSend 値。
Formatter XmlMessageFormatter
MessageReadPropertyFilter クラスのパラメーターなしのコンストラクターによって設定される MessagePropertyFilter 値。 すべてのフィルター値は に true設定されます。
DenySharedReceive false

こちらもご覧ください

適用対象

MessageQueue(String)

指定したパスのメッセージ キューのキューを参照する MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path);
public MessageQueue (string path);
new System.Messaging.MessageQueue : string -> System.Messaging.MessageQueue
Public Sub New (path As String)

パラメーター

path
String

この MessageQueue が参照するキューの場所。

例外

Path プロパティが無効です。プロパティが設定されていないためと考えられます。

次のコード例では、さまざまなパス名構文の種類を使用して新しい MessageQueue オブジェクトを作成します。 いずれの場合も、コンストラクターでパスが定義されているキューにメッセージを送信します。

#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

注釈

パス、形式名、またはラベルがわかっている特定のメッセージ キュー キューに新しい MessageQueue インスタンスを関連付ける場合は、このオーバーロードを使用します。 キューを参照する最初のアプリケーションに排他アクセス権を付与する場合は、 プロパティを DenySharedReceivetrue 設定するか、読み取りアクセス制限パラメーターを渡すコンストラクターを使用する必要があります。

コンストラクターは MessageQueue 、 クラスの新しいインスタンスを MessageQueue インスタンス化します。新しいメッセージ キュー キューは作成されません。 メッセージ キューで新しいキューを作成するには、 を使用 Create(String)します。

パラメーターの構文は、次の path 表に示すように、参照するキューの種類によって異なります。

[キューの種類] 構文
パブリック キュー MachineName\QueueName
専用キュー MachineName\Private$\QueueName
ジャーナル キュー MachineName\QueueName\Journal$
マシン ジャーナル キュー MachineName\Journal$
マシンの配信不能キュー MachineName\Deadletter$
マシン トランザクション配信不能キュー MachineName\XactDeadletter$

または、 または LabelFormatName使用して、次の表に示すようにキュー パスを記述することもできます。

関連項目 構文
書式名 FormatName: [ format name ] FormatName:Public= 5A5F7535-AE9A-41d4-935C-845C2AFF7112

FormatName:DIRECT=SPX:NetworkNumber; HostNumber\QueueName

FormatName:DIRECT=TCP: IPAddress\QueueName

FormatName:DIRECT=OS: MachineName\QueueName
ラベル Label: [ label ] Label: TheLabel

オフラインで作業するには、コンストラクターのパス名構文ではなく、形式名構文を使用する必要があります。 それ以外の場合は、プライマリ ドメイン コントローラーを使用して形式名へのパスを解決できないため、例外がスローされます。

のインスタンスの初期プロパティ値を次の MessageQueue表に示します。 これらの値は、 パラメーターで指定されたパスを持つメッセージ キューのプロパティに path 基づいています。

プロパティ 初期値
Authenticate false
BasePriority 0
Category Empty
DefaultPropertiesToSend クラスのパラメーターなしのコンストラクターによって設定される DefaultPropertiesToSend 値。
EncryptionRequired trueメッセージ キューのプライバシー レベル設定が "Body" の場合は 。それ以外の場合は false
Formatter XmlMessageFormatter
Label Empty
MachineName メッセージ キューのコンピューター名プロパティの値。
MaximumJournalSize InfiniteQueueSize
MaximumQueueSize InfiniteQueueSize
MessageReadPropertyFilter クラスのパラメーターなしのコンストラクターによって設定される MessagePropertyFilter 値。
Path Emptyコンストラクターによって設定されていない場合は 。
QueueName Emptyコンストラクターによって設定されていない場合は 。
DenySharedReceive false
UseJournalQueue trueメッセージ キュー オブジェクトのジャーナル設定が有効になっている場合は 。それ以外の場合は false

こちらもご覧ください

適用対象

MessageQueue(String, Boolean)

指定した読み取りアクセス制限を持つ指定したパスのメッセージ キューのキューを参照する MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, bool sharedModeDenyReceive);
public MessageQueue (string path, bool sharedModeDenyReceive);
new System.Messaging.MessageQueue : string * bool -> System.Messaging.MessageQueue
Public Sub New (path As String, sharedModeDenyReceive As Boolean)

パラメーター

path
String

この MessageQueue が参照するキューの場所。ローカル コンピューターの場合は "." にできます。

sharedModeDenyReceive
Boolean

キューにアクセスする最初のアプリケーションに排他読み取りアクセス許可を与える場合は true。それ以外の場合は false

例外

Path プロパティが無効です。プロパティが設定されていないためと考えられます。

次のコード例では、排他アクセスを使用して新しい MessageQueue を作成し、そのパスを設定して、キューにメッセージを送信します。

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

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

   // Requests exlusive read access to the queue. If
   // access is granted, receives a message from the 
   // queue.
   void GetExclusiveAccess()
   {
      try
      {
         
         // Request exclusive read access to the queue.
         MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue",true );
         
         // Receive a message. This is where SharingViolation 
         // exceptions would be thrown.
         Message^ myMessage = myQueue->Receive();
      }
      catch ( MessageQueueException^ e ) 
      {
         
         // Handle request for denial of exclusive read access.
         if ( e->MessageQueueErrorCode == MessageQueueErrorCode::SharingViolation )
         {
            Console::WriteLine( "Denied exclusive read access" );
         }

         
         // Handle other sources of a MessageQueueException.
      }

      
      // Handle other exceptions as necessary.
      return;
   }

};


// Provides an entry point into the application.
// This example connects to a message queue, and
// requests exclusive read access to the queue.
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   
   // Output the count of Lowest priority messages.
   myNewQueue->GetExclusiveAccess();
   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 connects to a message queue, and
        // requests exclusive read access to the queue.
        //**************************************************

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

            // Output the count of Lowest priority messages.
            GetExclusiveAccess();
                        
            return;
        }

        //**************************************************
        // Requests exlusive read access to the queue. If
        // access is granted, receives a message from the
        // queue.
        //**************************************************
        
        public static void GetExclusiveAccess()
        {
            try
            {
                // Request exclusive read access to the queue.
                MessageQueue myQueue = new
                    MessageQueue(".\\myQueue", true);

                // Receive a message. This is where SharingViolation
                // exceptions would be thrown.
                Message myMessage = myQueue.Receive();
            }
            
            catch (MessageQueueException e)
            {
                // Handle request for denial of exclusive read access.
                if (e.MessageQueueErrorCode ==
                    MessageQueueErrorCode.SharingViolation)
                {
                    Console.WriteLine("Denied exclusive read access");
                }

                // Handle other sources of a MessageQueueException.
            }

            // Handle other exceptions as necessary.

            return;
        }
    }
}
Imports System.Messaging

Public Class MyNewQueue


        ' Provides an entry point into the application.
        '		 
        ' This example connects to a message queue, and
        ' requests exclusive read access to the queue.
 

        Public Shared Sub Main()

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

            ' Output the count of Lowest priority messages.
            myNewQueue.GetExclusiveAccess()

            Return

        End Sub


  
        ' Requests exlusive read access to the queue. If
        ' access is granted, receives a message from the 
        ' queue.
  

        Public Sub GetExclusiveAccess()

            Try

                ' Request exclusive read access to the queue.
                Dim myQueue As New MessageQueue(".\myQueue", True)

                ' Receive a message. This is where a SharingViolation 
                ' exception would be thrown.
                Dim myMessage As Message = myQueue.Receive()

            Catch e As MessageQueueException

                ' Handle request for denial of exclusive read access.
                If e.MessageQueueErrorCode = _
                    MessageQueueErrorCode.SharingViolation Then

                    Console.WriteLine("Denied exclusive read access.")

                End If

                ' Handle other sources of a MessageQueueException.

                ' Handle other exceptions as necessary.

            End Try

            Return

        End Sub

End Class

注釈

パス、形式名、またはラベルがわかっている特定のメッセージ キューに新しい MessageQueue キューを関連付ける場合は、このオーバーロードを使用します。 キューを参照する最初のアプリケーションに排他アクセス権を付与する場合は、 パラメーターを sharedModeDenyReceivetrue設定します。 それ以外の場合は、 にfalse設定sharedModeDenyReceiveするか、 パラメーターのみを持つコンストラクターをpath使用します。

を にtrue設定sharedModeDenyReceiveすると、他のアプリケーションを含め、メッセージ キューキューにアクセスするすべてのオブジェクトに影響します。 パラメーターの効果は、このアプリケーションに限定されません。

コンストラクターは MessageQueue 、 クラスの新しいインスタンスを MessageQueue 作成します。新しいメッセージ キュー キューは作成されません。 メッセージ キューで新しいキューを作成するには、 を使用 Create(String)します。

パラメーターの path 構文は、キューの種類によって異なります。

[キューの種類] 構文
パブリック キュー MachineName\QueueName
専用キュー MachineName\Private$\QueueName
ジャーナル キュー MachineName\QueueName\Journal$
マシン ジャーナル キュー MachineName\Journal$
マシンの配信不能キュー MachineName\Deadletter$
マシン トランザクション配信不能キュー MachineName\XactDeadletter$

または、メッセージ キューキューの形式名またはラベルを使用して、キューパスを記述することもできます。

関連項目 構文
書式名 FormatName: [ format name ] FormatName:Public= 5A5F7535-AE9A-41d4-935C-845C2AFF7112

FormatName:DIRECT=SPX:NetworkNumber; HostNumber\QueueName

FormatName:DIRECT=TCP: IPAddress\QueueName

FormatName:DIRECT=OS: MachineName\QueueName
ラベル Label: [ label ] Label: TheLabel

オフラインで作業するには、フレンドリ名の構文ではなく、形式名の構文を使用する必要があります。 それ以外の場合は、プライマリ ドメイン コントローラー (Active Directory が存在する) を使用して形式名のパスを解決できないため、例外がスローされます。

MessageQueueパラメーターを にtrue設定してキューをsharedModeDenyReceive開くと、その後キューから読み取りを試みるとMessageQueue、共有違反が原因で が生成MessageQueueExceptionされます。 MessageQueueExceptionは、 が排他モードでキューにアクセスしようとしたときに、別のがMessageQueue既にキューへの非排他的アクセスを持っている場合MessageQueueにもスローされます。

のインスタンスの初期プロパティ値を次の MessageQueue表に示します。 これらの値は、 パラメーターで指定されたパスを使用して、メッセージ キューのプロパティに path 基づいています。

プロパティ 初期値
Authenticate false.
BasePriority 0。
Category Empty.
DefaultPropertiesToSend クラスのパラメーターなしのコンストラクターによって設定される DefaultPropertiesToSend 値。
EncryptionRequired trueメッセージ キューのプライバシー レベル設定が "Body" の場合は 。それ以外の場合は false
Formatter XmlMessageFormatter.
Label Empty.
MachineName メッセージ キューのコンピューター名プロパティの値。
MaximumJournalSize InfiniteQueueSize.
MaximumQueueSize InfiniteQueueSize.
MessageReadPropertyFilter クラスのパラメーターなしのコンストラクターによって設定される MessagePropertyFilter 値。
Path Emptyコンストラクターによって設定されていない場合は 。
QueueName Emptyコンストラクターによって設定されていない場合は 。
DenySharedReceive sharedModeDenyReceive パラメーターの値。
UseJournalQueue trueメッセージ キュー オブジェクトのジャーナル設定が有効になっている場合は 。それ以外の場合は false

こちらもご覧ください

適用対象

MessageQueue(String, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, System::Messaging::QueueAccessMode accessMode);
public MessageQueue (string path, System.Messaging.QueueAccessMode accessMode);
new System.Messaging.MessageQueue : string * System.Messaging.QueueAccessMode -> System.Messaging.MessageQueue
Public Sub New (path As String, accessMode As QueueAccessMode)

パラメーター

path
String

この MessageQueue が参照するキューの場所。ローカル コンピューターの場合は "." にできます。

accessMode
QueueAccessMode

QueueAccessMode 値のいずれか 1 つ。

適用対象

MessageQueue(String, Boolean, Boolean)

MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, bool sharedModeDenyReceive, bool enableCache);
public MessageQueue (string path, bool sharedModeDenyReceive, bool enableCache);
new System.Messaging.MessageQueue : string * bool * bool -> System.Messaging.MessageQueue
Public Sub New (path As String, sharedModeDenyReceive As Boolean, enableCache As Boolean)

パラメーター

path
String

この MessageQueue が参照するキューの場所。ローカル コンピューターの場合は "." にできます。

sharedModeDenyReceive
Boolean

キューにアクセスする最初のアプリケーションに排他読み取りアクセス許可を与える場合は true。それ以外の場合は false

enableCache
Boolean

接続キャッシュを作成し、使用する場合は true。それ以外の場合は false

次のコード例では、排他的読み取りアクセスと接続キャッシュが有効な新しい MessageQueue を作成します。

// Connect to a queue on the local computer, grant exclusive read
// access to the first application that accesses the queue, and
// enable connection caching.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue", true, true);

queue->Close();
// Connect to a queue on the local computer, grant exclusive read
// access to the first application that accesses the queue, and
// enable connection caching.
MessageQueue queue = new MessageQueue(".\\exampleQueue", true, true);

適用対象

MessageQueue(String, Boolean, Boolean, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, bool sharedModeDenyReceive, bool enableCache, System::Messaging::QueueAccessMode accessMode);
public MessageQueue (string path, bool sharedModeDenyReceive, bool enableCache, System.Messaging.QueueAccessMode accessMode);
new System.Messaging.MessageQueue : string * bool * bool * System.Messaging.QueueAccessMode -> System.Messaging.MessageQueue
Public Sub New (path As String, sharedModeDenyReceive As Boolean, enableCache As Boolean, accessMode As QueueAccessMode)

パラメーター

path
String

この MessageQueue が参照するキューの場所。ローカル コンピューターの場合は "." にできます。

sharedModeDenyReceive
Boolean

キューにアクセスする最初のアプリケーションに排他読み取りアクセス許可を与える場合は true。それ以外の場合は false

enableCache
Boolean

接続キャッシュを作成し、使用する場合は true。それ以外の場合は false

accessMode
QueueAccessMode

QueueAccessMode 値のいずれか 1 つ。

適用対象