COM+ Events and Transactions

COM+ transactions flow downward from the transaction root, as you have seen in Chapter 4. New objects created during the transaction take part in their creator’s transaction or are placed in a transaction of their own, according to their transaction configuration.

If the publisher takes part in a transaction, it is recommended that the subscribers participate in the publisher’s transaction. But how would the transaction be propagated by the publisher to the subscriber if the publisher does not create the subscriber directly?

To propagate the publisher’s transaction to the subscriber, you should configure the event class to support or require transactions. Like any other COM+ component, the event class has a Transaction tab that applies to the COM+ synthesized implementation.

Adding the event class to your transaction will not affect the transaction voting result; in any COM+ context the consistency bit is set by default to TRUE and the COM+-provided implementation of the event class does not change that bit. You also need to configure the (persistent) subscriber component to support transactions. Now the subscriber takes part in the publisher’s transaction and it can abort the publisher’s transaction or vote to commit it.

There is one more thing you should keep in mind when mixing COM+ events and transactions: Do not configure the event class to require a new transaction. This causes the subscriber to take part in a separate transaction, the one initiated ...

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.