InterfaceQueuingAttribute Class
Assembly: System.EnterpriseServices (in system.enterpriseservices.dll)
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, Inherited=true, AllowMultiple=true)] public sealed class InterfaceQueuingAttribute : 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
Not applicable.
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 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 } }
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 = (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);