IConnection
A Connection object represents the active connection of the application to a messaging server.
- Inheritance hierarchy:
-
IBM.XMS.IPropertyContext | +----IBM.XMS.IConnection
For a list of the XMS defined properties of a Connection object, see Properties of Connection.
.NET properties
- Summary of .NET properties:
-
.NET property Description ClientID Get and set the client identifier for the connection. ExceptionListener Get the exception listener that is registered with the connection, and register an exception listener with the connection. MetaData Get the metadata for the connection.
ClientID - Get and Set Client ID
- Interface:
-
String ClientID { get; set; }
Get and set the client identifier for the connection.
The client identifier can either be preconfigured by the administrator in a ConnectionFactory, or assigned by setting ClientID.
A client identifier is used only to support durable subscriptions in the publish/subscribe domain, and is ignored in the point-to-point domain.
If an application sets a client identifier for a connection, the application must do so immediately after creating the connection, and before performing any other operation on the connection. If the application tries to set a client identifier after this point, the call throws exception IllegalStateException.
This property is not valid for a real-time connection to a broker.
- Exceptions:
- XMSException
- IllegalStateException
- InvalidClientIDException
ExceptionListener - Get and Set Exception Listener
- Interface:
-
ExceptionListener ExceptionListener { get; set; }
Get the exception listener that is registered with the connection, and register an exception listener with the connection.
If no exception listener is registered with the connection, the method returns null. If an exception listener is already registered with the connection, you can cancel the registration by specifying a null instead of the exception listener.
For more information about using exception listeners, see Using message and exception listeners in .NET.
- Exceptions:
- XMSException
Metadata - Get Metadata
- Interface:
-
IConnectionMetaData MetaData { get; }
Get the metadata for the connection.
- Exceptions:
- XMSException
Methods
- Summary of methods:
-
Method Description Close Close the connection. CreateSession Create a session. Start Start or restart the delivery of incoming messages for the connection. Stop Stop the delivery of incoming messages for the connection.
Close - Close Connection
- Interface:
-
void Close();
Close the connection.
If an application tries to close a connection that is already closed, the call is ignored.
- Parameters:
- None
- Returns:
- Void
- Exceptions:
- XMSException
CreateSession - Create Session
- Interface:
-
ISession CreateSession(Boolean transacted, AcknowledgeMode acknowledgeMode);
Create a session.
- Parameters:
- transacted (input)
- The value
Truemeans that the session is transacted. The valueFalsemeans that the session is not transacted.For a real-time connection to a broker, the value must be
False. - acknowledgeMode (input)
- Indicates that how messages received by an application are acknowledged. The value must be one
of the following from the AcknowledgeMode enumerator:
AcknowledgeMode.AutoAcknowledgeAcknowledgeMode.ClientAcknowledgeAcknowledgeMode.DupsOkAcknowledge
AcknowledgeMode.AutoAcknowledgeorAcknowledgeMode.DupsOkAcknowledgeThis parameter is ignored if the session is transacted. For more information about acknowledgment modes, see Message acknowledgment.
- Returns:
- The Session object
- Exceptions:
- XMSException
Start - Start Connection
- Interface:
-
void Start();
Start or restart the delivery of incoming messages for the connection. The call is ignored if the connection is already started.
- Parameters:
- None
- Returns:
- Void
- Exceptions:
- XMSException
Stop - Stop Connection
- Interface:
-
void Stop();
Stop the delivery of incoming messages for the connection. The call is ignored if the connection is already stopped.
- Parameters:
- None
- Returns:
- Void
- Exceptions:
- XMSException
Inherited properties and methods
- GetBooleanProperty, GetByteProperty, GetBytesProperty, GetCharProperty, GetDoubleProperty, GetFloatProperty, GetIntProperty, GetLongProperty, GetObjectProperty, GetShortProperty, GetStringProperty, SetBooleanProperty, SetByteProperty, SetBytesProperty, SetCharProperty, SetDoubleProperty, SetFloatProperty, SetIntProperty, SetLongProperty, SetObjectProperty, SetShortProperty, SetStringProperty