COM+ Services with Queued Components



COM+ Services such as Transactions, Security and Loosely coupled events can be used in Combination with Queued components.

Many other services are also available but let us have a look at some of these noteworthy services..


Role-Based Security


COM+ role-based security is supported for queued components even though the lifetimes of the client and component do not overlap. When the recorder packages method calls into an MSMQ message, the client’s security context is also included in the message. When the message reaches the component, the player unpacks the client’s security context. As the player begins to play back the method calls, the queued component sees the calls as if they were coming directly from the client. Because of this, the queued component can define roles and allow or deny access to its interfaces based on those roles. In addition, calls such as ContextUtil. IsCallerInRole are based on the context of the original caller, the client.



Transactions are an integral part of queued components. COM+ transactions occur on the client side when the recorder is invoked and on the server side when the ListenerHelper returns the unconfigured player object. For your server-side objects, this means that they are invoked in the ListenerHelper’s transaction if they support or require a transaction. If your component runs in the ListenerHelper’s transaction and it calls ContextUtil.SetAbort or ContextUtil.Disable Commit(), the message goes back on the queue and is retried. This can lead to a poison message that ends up on the component’s final resting queue if the component consistently aborts the transaction.

The recorder is configured to require a transaction. Clients that run in transactions include the recorder in their transactions when they invoke the queued component through the moniker. If the client aborts the transaction, the message is not delivered to the queued component’s input queue. These messages can be taken off the queue during a failed transaction because of MSMQ’s support for COM+ transactions. MSMQ provides a resource manager that participates in DTC transactions.


Loosely coupled events

Of all the services COM+ offers, loosely coupled events implement the closest development model to queued components. Like queued components, loosely coupled events provide one-way processing of client calls to components.

Queued components can be used to provide asynchronous notification of events. There are a couple of ways queued components can be used with events. Your first option is to make the event class a queued component. In this scenario, publishers use the Marshal class and queue moniker to instantiate the queued event class. Method calls are generated and inserted into an MSMQ message as normal. When the messages reach the event class, the recorder plays the methods, and the events fire to subscribers.

Your second option is to queue the interfaces of subscribers. In this option, publishers consume the event class as they normally do but without MSMQ interaction. As events fire, the event system passes method calls to the recorder, and MSMQ delivers messages to subscribers.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.