InterfaceQueuingAttribute Class
Enables queuing support for the marked interface. This class cannot be inherited.
Assembly: System.EnterpriseServices (in System.EnterpriseServices.dll)
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 __gc __interface IQueuedComponent
{
void QueuedTask();
};
// Mark IQueuedComponent interface as queued
[InterfaceQueuing(true, Interface=S"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 __gc class QueuedComponent : public ServicedComponent, public IQueuedComponent
{
public:
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(S"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);
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.