WebLogic Messaging API Class Library

IConnection Methods

The methods of the IConnection interface are listed below. For a complete list of IConnection interface members, see the IConnection Members topic.

Public Instance Methods

CloseCloses the connection. Since a provider typically allocates significant resources outside the JVM on behalf of a connection, clients should Close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.There is no need to Close the sessions, producers, and consumers of a closed connection. Similarly, there is no need to Close a connection if its parent context has been closed with CloseAll. When this method is invoked, it does not return until message processing has been shut down in an orderly fashion. This means that all message listeners that may have been running have returned, and that all pending receives have returned. A Close terminates all pending message receives on the connection's sessions' consumers. The receives may return with a message or with null, depending on whether there was a message available at the time of the Close. If one or more of the connection's sessions' message listeners is processing a message at the time when connection Close is invoked, all the facilities of the connection and its sessions remain available to those listeners until they return control to the JMS provider.Closing a connection causes any of its sessions' transactions in progress to be rolled back. In the case where a session's work is coordinated by an external transaction manager, a session's Commit and Rollback methods are not used and the result of a closed session's work is determined later by the transaction manager (this type of transaction is not supported in the first release of the WebLogic JMS .NET client). Closing a connection does NOT force an acknowledgment of client-acknowledged sessions. Invoking the Acknowledge method of a received message from a closed connection's session throws an IllegalStateException. Closing a closed connection does NOT throw an exception.
CreateSession Creates an ISession object. Warning: While an IConnection object supports multi-threaded access, an ISession object only supports single threaded access and multi-threaded behavior is undefined. If an application requires multiple concurrently active consumers and/or producers, then the application must create multiple sessions. See the WebLogic .NET programmer's guide best practices section for additional details on properly coding applications for thread safety when using sessions and their child messages, consumers, and producers; also see the API class doc for WebLogic.Messaging.ISession.
StartStarts (or restarts) a connection's delivery of incoming messages. A call to Start on a connection that has already been started is ignored.
StopTemporarily stops a connection's delivery of incoming messages. Delivery can be restarted using the connection's Start method. When the connection is stopped, delivery to all the connection's message consumers is inhibited: synchronous receives block, and messages are not delivered to message listeners. This call blocks until receives and/or message listeners in progress have completed.Stopping a connection has no effect on its ability to send messages. A call to Stop on a connection that has already been stopped is ignored.A call to Stop will not return until delivery of messages has paused. This means that a client can rely on the fact that none of its message listeners will be called and that all threads of control waiting for Receive calls to return will not return with a message until the connection is restarted. The receive timers for a stopped connection continue to advance, so receives may time out while the connection is stopped.If message listeners are running when Stop is invoked, the Stop call waits until all of them have returned before it may return. While these message listeners are completing, they have the full services of the connection available to them.

See Also

IConnection Interface | WebLogic.Messaging Namespace | IConnectionFactory