Geeks With Blogs
Koushal Deshpande kd

For my current client we are implementing BizTalk. I was suppose to design a solution which will receive message from Oracle AQ, transform it and send it to destination in MSMQ. Flow is pretty simple. I had to track the message in Audit database during execution.

I designed it as always, I used long running transaction for orchestration and scope. Put all processing within scope except message receive. Exception was handled in exception block. Audit record if created would be compensated in database. Client already had some projects in Biztalk and are running successfully. According to those design standard, they were reluctant to make any changes. They wanted to have everything in atomic scope.

Now if you put atomic scope in orchestration you can not have WCF send - receive port for audit database within scope. How it was done before was new to me and I had never done.

In a dotnet component project a class was created. Lets call it DatabaseTx. It would extend class ServicedComponent from System.EnterpriseServices.

In this class two methods would be created for aborting and committing. These would be used if you want to exclusively commit or rollback anything within transaction.

We will create another custom class MessageStore which will extend DatabaseTx. Make sure you have declared class DatabaseTx as abstract else it will give error while registering.

Second class will have method to connect database and execute stored procedure. It can any command. It can connect to any database and execute any command. We have used simillar model for Oracle database as well.

Orchestration will create a object of MessageStore in atomic scope and call method with required parameters. Transaction would be used of scope and data changes will be committed to database only when transaction exits successfully. If any exception occurs, everything will be rolled back.

Since class is created how will it get registered with COM+. Project is built and signed. Assembly is created. We will then register the assembly with COM+ with following command:

"RegSvcs.exe %dllpath%Generic.Components.dll "

Go to command prompt and execute above command with replacing dll path. This will get registered in COM. Now transaction will get created in COM which will take care of rollback or commit.

Happy BizTalking and coding!!!

Posted on Thursday, June 6, 2013 2:49 PM BizTalk 2010 , c# , COM , database transaction , BizTalk | Back to top

Comments on this post: COM+ Component for Database Transaction

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Koushal Deshpande | Powered by: