new Connection()
This method is not meant to be used directly.
Creates a Connection object that wraps an underlying
LightstreamerClient object into a JMS Extender compatible
connection.
Method Summary
- close
- Closes the connection.
- createSession
- Creates a Session object.
- getClientID
- Gets the client identifier for this connection.
- getExceptionListener
- Gets the ExceptionListener object for this connection.
- setClientID
- Sets the client identifier for this connection.
- setExceptionListener
- Sets an exception listener for this connection.
- start
- Starts (or restarts) the connection's delivery of incoming messages.
- stop
- Temporarily stops the connection's delivery of incoming messages.
Method Detail
-
close()
-
Closes the connection. All message producers and consumers will be stopped and their subsequent use will cause an IllegalStateException. A call to Connection#close on a connection that has already been closed is ignored.
Implementation note: underlying subscriptions are unsubscribed and deleted. If the connection was created through a ConnectionFactory the underlying LightstreamerClient connection is also disconnected. This means any message being sent (JMS messages, acknowledges, unsubscriptions, etc.) may get lost if the library did not have enough time to deliver them. -
createSession(transacted, acknowledgeMode) → {Session}
-
Creates a Session object.
Parameters:
Name Type Description transacted
Boolean flag that specifies if the session is transacted. acknowledgeMode
String specifies the type of acknowledge to be used for messages. Can be "PRE_ACK"
,"AUTO_ACK"
,"CLIENT_ACK"
,"DUPS_OK"
or"INDIVIDUAL_ACK"
. See JMS Extender documentation for more informations.Returns:
- Type
- Session
-
getClientID() → {String}
-
Gets the client identifier for this connection. See JMS specifications for more informations.
Returns:
- Type
- String
-
getExceptionListener() → {ExceptionListener}
-
Gets the ExceptionListener object for this connection.
Returns:
- Type
- ExceptionListener
-
setClientID(clientId)
-
Sets the client identifier for this connection. See JMS specifications for more informations.
Implementation note: scalability considerations apply when the client ID is set, see JMS Extender documentation.Parameters:
Name Type Description clientId
String the unique client identifier -
setExceptionListener(exceptionListener)
-
Sets an exception listener for this connection. Many common JMS exceptions will be delivered asynchronously through this listener.
Parameters:
Name Type Description exceptionListener
ExceptionListener the exception listener meant to receive exceptions for this connection. -
start()
-
Starts (or restarts) the connection's delivery of incoming messages. A call to Connection#start on a connection that has already been started is ignored.
-
stop()
-
Temporarily stops the connection's delivery of incoming messages. Delivery can be restarted using the connection's Connection#start method. A call to Connection#stop on a connection that has already been stopped is ignored.
Stopping a connection has no effect on its ability to send messages.
Implementation note: underlying subscriptions are unsubscribed but their item names are kept for a later restart.