Support for transaction in an Activity

  • 19 May 2004
  • 1 reply
  • 0 views

Badge +7
How do we have server events in an activity be executed as a single transaction?

For example, an activity has 3 events. The 1st event has to update an Oracle DB, a 2nd event updates Sql Sever DB, and a third event updates value of a process data field. How to control these events as a unique transaction? How do we preserve data integrity in a transaction rollback?

1 reply

Badge +7
Transactions in K2.net 2003 depends on COM+ in Windows 2000 or Windows 2003. The component for which you implement transactions must be a .NET assembly which implements the .NET Enterprise Services.

The developer is responsible for coding the transaction logic (BEGIN, COMMIT and ROLLBACK) into the assembly. Once your assembly is developed as a transaction COM+ component, register it in COM+ with the transaction type specified as "Required" - setting in COM+.

When you instantiate your assembly in a K2.net 2003 Server event with transactions enabled (via the checkbox), K2.net adds the assembly to the K2 transaction scope, which means that if K2.net hits a snag and have to roll back, your assembly will also get a rollback instruction. If K2.net commits, your assembly will commit. This scope is managed by COM+ in the K2.net 2003 Server process space.

Therefore, in the context of the scenario above, you will need to compose each of the update action code and rollback code into a .NET assembly that is COM+ transaction enabled. At the Activity's property settings, the "Execute ALL events as one Transaction" needs to be selected. For each of the server event that invokes the COM+ Transactions, the "Execute Event in a Transaction" needs to be selected as well.

All K2.net 2003 database state has been fully transaction aware since our release version. K2.net 2003 SP1 will also allow referenced assemblies which are transaction aware to participate in K2.net's transaction scope.

Reply