InterfaceQueuingAttribute クラス
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)

<ComVisibleAttribute(False)> _ <AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface, Inherited:=True, AllowMultiple:=True)> _ Public NotInheritable Class InterfaceQueuingAttribute Inherits Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, Inherited=true, AllowMultiple=true)] public sealed class InterfaceQueuingAttribute : Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface, Inherited=true, AllowMultiple=true)] public ref class InterfaceQueuingAttribute sealed : public Attribute

このインターフェイスでの呼び出しは、メッセージ キューに置かれます。
キューに置かれているインターフェイスとしてインターフェイスをマークするには、[InterfaceQueuing] という構文を使用して、この属性をインターフェイスに適用します。
キューに置かれたインターフェイスのメンバ メソッドは、キューに置かれたメソッド呼び出しの要件 (out パラメータや ref パラメータを持たないなど) を満たす必要があります。

InterfaceQueuingAttribute 属性の使用方法を次のコード例に示します。
public interface IQueuedComponent { void QueuedTask(); } // Mark IQueuedComponent interface as queued [InterfaceQueuing(true, Interface="IQueuedComponent")] // Create the queued component class by inheriting the // System.EnterpriseServices.ServicedComponent class and an // interface that is marked as queued with the InterfaceQueuing attribute public class QueuedComponent : ServicedComponent, IQueuedComponent { public void QueuedTask() { // Perform queued task here } }
public interface class IQueuedComponent { void QueuedTask(); }; // Mark IQueuedComponent interface as queued // Create the queued component class by inheriting the // System.EnterpriseServices.ServicedComponent class and an // interface that is marked as queued with the InterfaceQueuing attribute [InterfaceQueuing(true,Interface="IQueuedComponent")] public ref class QueuedComponent sealed: public ServicedComponent, public IQueuedComponent { public: virtual void QueuedTask() { // Perform queued task here } };
ApplicationQueuing 属性を使用して、コンパイル時に COM+ アプリケーションをキューに置かれているアプリケーションとしてマークし、QueueListenerEnabled を true に設定することにより COM+ リスナを有効化する方法を次のコード例に示します。
// Mark the COM+ application as queued at compile time by using the // ApplicationQueuing attribute. Enable the COM+ listener by // setting the QueueListenerEnabled to true [assembly: ApplicationQueuing(Enabled=true, QueueListenerEnabled=true)]
// Mark the COM+ application as queued at compile time by using the // ApplicationQueuing attribute. Enable the COM+ listener by // setting the QueueListenerEnabled to true [assembly:ApplicationQueuing(Enabled=true,QueueListenerEnabled=true)];
BindToMoniker を使用して、キューに置かれているモニカを実行し、レコーダーのインスタンスを取得し、記録されるメソッドを呼び出し、レコーダー オブジェクトを強制的に解放し、メッセージをキューに送信する方法を次のコード例に示します。
// Use BindToMoniker to run the queued moniker, to get an instance of the recorder IQueuedComponent qc = (IQueuedComponent)System.Runtime.InteropServices.Marshal.BindToMoniker("queue:/new:QueuedComponent"); // Call the method that will be recorded qc.QueuedTask(); // Force the release of the recorder object, to send the message to the queue System.Runtime.InteropServices.Marshal.ReleaseComObject(qc);
// Use BindToMoniker to run the queued moniker, to get an instance of the recorder IQueuedComponent ^ qc = dynamic_cast<IQueuedComponent^>(System::Runtime::InteropServices::Marshal::BindToMoniker( "queue:/new:QueuedComponent" )); // Call the method that will be recorded qc->QueuedTask(); // Force the release of the recorder object, to send the message to the queue System::Runtime::InteropServices::Marshal::ReleaseComObject( qc );

System.Attribute
System.EnterpriseServices.InterfaceQueuingAttribute


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- InterfaceQueuingAttribute クラスのページへのリンク