TIBCO EMS .NET API 8.4
TIBCO EMS .NET API 8.4
TIBCO.EMS.EMSDTCConnection Class Reference

A Connection object is a client's active connection to TIBCO EMS Server. A EMSDTCConnection should be used when the client intends to participate in a MSDTC transaction (i.e. System.Transactions.Transaction) More...

Inherits XAConnection.

Public Member Functions

EMSDTCSession CreateEMSDTCSession ()
 Returns an EMSMSDTCSession. Only EMSDTCSession's will be allowed to participate in MSDTC distributed transactions. More...
 

Detailed Description

A Connection object is a client's active connection to TIBCO EMS Server. A EMSDTCConnection should be used when the client intends to participate in a MSDTC transaction (i.e. System.Transactions.Transaction)

Connections support concurrent use.

A connection serves several purposes:

  • It encapsulates an open connection with a TIBCO EMS Server. It typically represents an open TCP/IP socket between a client and the TIBCO EMS Server.
  • Its creation is where client authentication takes place.
  • It can specify a unique client identifier.
  • It provides a ConnectionMetaData object.
  • It supports an optional ExceptionListener object.

Because the creation of a connection involves setting up authentication and communication, a connection is a relatively heavyweight object. Most clients will do all their messaging with a single connection. Other more advanced applications may use several connections.

A client typically creates a connection, one or more sessions, and a number of message producers and consumers. When a connection is created, it is in stopped mode. That means that no messages are being delivered.

It is typical to leave the connection in stopped mode until setup is complete and all message consumers have been created. At that point, the client calls the connection's Start method, and messages begin arriving at the connection's consumers. (Outbound messages flow even before calling Start.) This setup convention minimizes any client confusion that may result from asynchronous message delivery while the client is still in the process of setting itself up.

A connection can be started immediately and the setup can be done afterwards. Clients that do this must be prepared to handle asynchronous message delivery while they are still in the process of setting up.

A message producer can send messages while a connection is stopped

Member Function Documentation

EMSDTCSession TIBCO.EMS.EMSDTCConnection.CreateEMSDTCSession ( )
inline

Returns an EMSMSDTCSession. Only EMSDTCSession's will be allowed to participate in MSDTC distributed transactions.

Returns
An EMSDTCSession

The presence of an ambient transaction will cause the session to be automatically enlisted with Microsoft DTC when the session's producer produces or consumer consumes the first message within a transaction scope.

Before producing or consuming messages (from producers/consumers created off this EMSDTCSession) one has to make sure that there is already an ambient transaction started. Please see System.Transactions.TransactionScope or System.Transactions.CommittableTransaction on how to start a an ambient transaction.

Example:
EMSDTCConnectionFactory fc = new EMSDTCConnectionFactory("tcp://localhost:7222");
fc.ClientId = "test-clientId";
EMSDTConnection dtcConn = fc.CreateEMSDTCConnection();
EMSDTCSession dtcSess = dtcConn.CreateEMSDTCSession();

Copyright © TIBCO Software Inc. All rights reserved.