Monday, January 10, 2011

What Is MTS?

MTS consists of several unrelated capabilities lumped together under a single name. Microsoft, recognizing that MTS is not an accurate name for this collection of features, has renamed MTS to COM+ in Windows 2000.

MTS is an object broker. That means it maintains a list of objects and facilitates other programs' use of those objects. MTS facilitates code reuse. Without MTS, you would have a difficult time sharing objects within your program and between programs. You would have to set up a pool of objects, then devise ways of sharing them without conflict.

MTS is also a transaction monitor. MTS can monitor and manage transactions—work that must either complete successfully or fail totally across multiple components. For example, suppose you want to send e-mail to an administrator each time an employee changes personal income tax deductions. The transaction consists of all the operations required for the employee to make the change in a database and also all the operations required for the program to compose and send the e-mail message to an administrator. If any error occurs when making the database changes, you don't want the program to send the e-mail. If the database changes succeed, you must send the e-mail message successfully; otherwise, you need to roll back the changes in the database and inform the employee that the program cannot make the changes.

If you set this up, you would need to write code to ensure that each part of the process completed successfully before committing the transaction. You would also need to write code to roll back the transaction if any error occurred. MTS handles all these issues for you.

MTS uses components to perform the units of work involved in a transaction. A component and a class are, to the VB programmer, essentially identical. VB programmers discuss classes and objects. MTS programmers discuss components. A component has a specific COM interface, and so does a VB class. A DLL may contain several components or classes, just like in VB. You can't create classes with multiple interfaces in VB (although you can make classes that use multiple interfaces).

1 comment:

  1. It's really good article which helped me lot of to resolve my issues... thanks a lot.

    ReplyDelete