Delivering Events

Once an event is published, COM+ is responsible for delivering the event to the subscribers. By default, publishers have very little to do with the delivery itself, to ensure decoupling of publishers from subscribers. However, COM+ does provide you ways to fine-tune the delivery and obtain additional information on the result of firing the event to the subscribers.

Serial Versus Parallel Publishing

Events by default are fired serially at subscribers—COM+ goes through the list of subscribers and publishes to them one at a time. The call to the event class does not return to the publisher until the last subscriber is notified. As a result, the publisher is blocked during publishing. To minimize the blocking time, you can configure your event class to use multiple threads for publishing by checking the "Fire in parallel” checkbox in the Advanced tab of the event class properties page (see Figure 9-4).

This setting is a mere request that COM+ will fire in parallel, and COM+ is not required to comply. COM+ uses threads from the RPC pool of threads to publish to subscribers, so parallel publishing is subjected to pool limitations. You should consider Fire in parallel as an optimization technique only; avoid relying on it in your design. For example, do not count on having all the subscribers get the event at the same time.

Error Handling

When an event class succeeds in publishing to all the subscribers, it returns S_OK to the publisher. If the event is delivered to ...

Get COM & .NET Component Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.