Library Zone Articles
External Articles
Byte Size

Discovery Zone Catalogue
Diary
Links
Bookstore
Interactive Zone Ask the Gurus
Discussion Groups
Newsletters
Feedback
Etc Cartoons
Humour
COMpetition
Advertising
Site Builder ASP Web Ring ASP Web Ring

Click here
The Developer's Resource & Community Site
COM XML ASP Java & Misc. NEW: VS.NET
International This Week Forums Author Central Find a Job

Microsoft Transaction Server

MTS is primarily a container for in-process server side components.

In database applications, Transactions ensure integrity of data by combining a set of actions into a single atomic unit. A transaction is said to be committed if all the actions succeed as a whole and a rollback occurs if they fail. MTS allows you to define and use transactions within COM objects.

MTS can also be defined as a component-based programming model. An MTS component is a type of COM component that executes in the MTS run-time environment. To be qualified as an MTS component, it has to meet all the requirements of a COM component and the component should be developed as a DLL. Components that are implemented as EXEs cannot run in an MTS environment.

Just as a COM component can be modelled on the basis of interfaces and their implementation, MTS enforces modelling based on the component's state and behavior. This allows applications to coordinate their state across multiple machines. Since they are composed of COM objects, MTS applications can be implemented in a variety of different languages including Visual Basic, Java, C++ and even COBOL!

MTS handles communication between components through DCOM and HTTP protocols. This allows MTS to expose its components both to 16-bit and 32-bit applications from anywhere on the net or the web.

Some of the unique features that MTS brings into the component world are:

A unique Threading model

Components that use the Rental Threaded model (RTA), mark themselves as Free Threaded or Both. MTS handles thread synchronization for you by automatically creating threads when required and preventing you from creating threads of your own from within MTS components. MTS defines an Activity as a single execution context ( single logical thread of execution ) across different machines. MTS prevents more than one thread from calling into an Activity at any single point in time.

Roles and Packages

MTS takes Security to a totally new level. Packages are defined as a collection of MTS components that make up an application. Roles are a logical group of users of an MTS application. Security is administered to the whole package instead of its individual components. MTS thus separates the application security model from the OS's security model. This way, the security level of an MTS application can be programatically set.

Just in Time(JIT) Activation

MTS components are created only when they are required and are released as soon as they have finished. This concept called Object pooling increases the efficacy of object life-time management by calling methods on one of the object's interfaces to tell it when to obtain and free resources.

The MTS run-time is divided into three different parts:

  • The Surrogate process (MTS.EXE)
  • An NT Service called the Microsoft Distributed Transaction Coordinator ( MS DTC )
  • An Administrative tool called the MTS Explorer

The Surrogate Process

MTS can wrap components to provide a single execution context without you having to write components specifically for MTS. Once a component is registered as an MTS object, MTS.EXE will create a surrogate object or a class factory wrapper for that component and a context object through COM containment. This surrogate object now calls the class factory of the original component. This means that whenever calls are made to any component, MTS intercepts these calls. This allows MTS to provide facilities without either the client or the component having to be specifically written for MTS. One of the responsibilities of the context object is to cache the typelib info for each interface so that MTS can do object pooling efficiently.

Microsoft Distributed Transaction Coordinator

The DTC facilitates distributed transactions. If an MTS object were to fail during a transaction, all other objects in the transaction are aborted regardless of what machine they are running on. This service helps create transaction context objects that are used in the component context objects and helps in ensuring proper rollback of transactions. It is the MS DTC which provides MTS the scalability and the fail-safety required of any TP monitor program.

Resource Managers and Resource Dispensers

While the DTC coordinates transactions, it relies on the resource providers to understand particular types of data and know how to commit or rollback changes on those resources. Resource Managers handle data that is not lost should the system fail. If the system should fail, the state of a dispenser is not maintained because, Resource Dispensers handle non-durable data. MTS comes with one resource manager SQL Server 6.5 and a couple of resource dispensers ODBC Resource dispenser and Shared Property Manager.

MTS Explorer

To the system administrator, this is the visible part of MTS. It has a couple of main roles. It manages the objects that MTS can use and it allows the administrator to monitor the state of running objects.

In MTS, methods are invoked across a network or machine boundaries, using a modified version of DCE's RPC (like DCOM) or are directly accessed using the Microsoft Message Queue Sever (MSMQ).

Distributed security services are provided by the NT Lan Manager (NTLM) security protocol supported by both Windows and Windows NT.

MTS today relies on the Domain Name System (DNS) for Directory services. With NT 5.0, both DCOM and consequently MTS, will make use of a combination of the Lightweight Directory Access Protocol (LDAP) and DNS for providing directory services.


What do you think of this article?

Have your say about the article. You can make your point about the article by mailing [email protected] (If you haven't allready joined, you can join by going to https://www.onelist.com/community/dev-java).

You can also write a review. We will publish the best ones here on this article. Send your review to [email protected]. Please include the title of the article you are reviewing.

Further Reading

The MTS Series by Gopalan Suresh Raj:

Developing a Simple MTS Server Component By Gopalan Suresh Raj.
Part 1 of a two part example.

Developing a Simple MTS Client Application By Gopalan Suresh Raj.
Part 2 of a two part example.

Developing The Bank Account IDL By Gopalan Suresh Raj.
A Three-Tier Architecture for a Bank Checking Account - Developing The Bank Account IDL is part 1 of a 3 part example.

MTS Server Component By Gopalan Suresh Raj.
A Three-Tier Architecture for a Bank Checking Account - MTS Server Component is the second part of this three part example.

MTS Client By Gopalan Suresh Raj.
A Three-Tier Architecture for a Bank Checking Account - MTS Server Component is the third part of this three part example.


Author: Gopalan Suresh Raj

You can meet Gopalan, and the other iDevResource authors in Author Central. Gopalan also maintains his own site at https://www.execpc.com/~gopalan/.

Contributors to iDevResource.com get their own site at Author Central. Why not write an article and become a member of the iDevResource community.

© Copyright 1997-2000 Gopalan Suresh Raj. Reproduced with Permission


ASPWebhosting.com

Contribute to IDR:

To contribute an article to IDR, a click here.

To contact us at IDevResource.com, use our feedback form, or email us.

To comment on the site contact our webmaster.

Promoted by CyberSavvy UK - website promotion experts

All content © Copyright 2000 IDevResource.com, Disclaimer notice

Code Project

WTL Introduction

Learn C#

Visit our NEW WTL Section

Visit the IDR Bookstore!