A Connection object represents an application's active connection to a broker.
xms::PropertyContext | +----xms::Connection
For a list of the XMS defined properties of a Connection object, see Properties of Connection.
Method | Description |
---|---|
close | Close the connection. |
createSession | Create a session. |
getClientID | Get the client identifier for the connection. |
getExceptionListener | Get a pointer to the exception listener that is registered with the connection. |
getHandle | Get the handle that a C application would use to access the connection. |
getMetaData | Get the metadata for the connection. |
isNull | Determine whether the Connection object is a null object. |
setClientID | Set a client identifier for the connection. |
setExceptionListener | Register an exception listener with the connection. |
start | Start, or restart, the delivery of incoming messages for the connection. |
stop | Stop the delivery of incoming messages for the connection. |
Session createSession(const xmsBOOL transacted, const xmsINT acknowledgeMode);
For a real-time connection to a broker, the value must be xmsFALSE.
This parameter is ignored if the session is transacted. For more information about acknowledgement modes, see Message acknowledgement.
ExceptionListener * getExceptionListener() const;
Get a pointer to the exception listener that is registered with the connection.
For more information about using exception listeners, see Exception listeners in C++.
xmsVOID setClientID(const String & clientID);
Set a client identifier for the connection. 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 calls this method to set 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 call the method after this point, the call throws exception XMS_X_ILLEGAL_STATE_EXCEPTION.
This method is not valid for a real-time connection to a broker.
xmsVOID setExceptionListener(const ExceptionListener *lsr);
Register an exception listener with the connection.
For more information about using exception listeners, see Exception listeners in C++.
If an exception listener is already registered with the connection, you can cancel the registration by specifying a null pointer instead.