Export (0) Print
Expand All
1 out of 3 rated this helpful - Rate this topic

InterfaceQueuingAttribute Class

Enables queuing support for the marked interface. This class cannot be inherited.

Namespace: System.EnterpriseServices
Assembly: System.EnterpriseServices (in system.enterpriseservices.dll)

[ComVisibleAttribute(false)] 
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface, Inherited=true, AllowMultiple=true)] 
public ref class InterfaceQueuingAttribute sealed : public Attribute
/** @attribute ComVisibleAttribute(false) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, Inherited=true, AllowMultiple=true) */ 
public final class InterfaceQueuingAttribute extends Attribute
ComVisibleAttribute(false) 
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, Inherited=true, AllowMultiple=true) 
public final class InterfaceQueuingAttribute extends Attribute

Calls on this interface will be queued using Message Queuing.

To mark an interface as queued, apply this attribute to the interface using the following syntax: [InterfaceQueuing].

The member methods of a queued interface must fulfill the requirements for queued method calls, such as having no out or ref parameters.

For more information about using attributes, see Extending Metadata Using Attributes.

The following code example shows how to use the InterfaceQueuingAttribute attribute.

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
   }

};

The following code example shows how to mark a COM+ application as queued at compile time by using the ApplicationQueuing attribute, and enable the COM+ listener by setting the QueueListenerEnabled to 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)];

The following code example shows how to use BindToMoniker to run the queued moniker, to get an instance of the recorder, call the method that will be recorded, and force the release of the recorder object, to send the message to the queue.

// 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.Object
   System.Attribute
    System.EnterpriseServices.InterfaceQueuingAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.