Class: ConnectionListener

ConnectionListener

Interface to be implemented to listen to JMS connection outcome events. Methods of this interface are called during ConnectionFactory.createConnection, QueueConnectionFactory.createQueueConnection and TopicConnectionFactory.createTopicConnection calls, as the processing of JMS connection proceeds.
Note that it is not necessary to implement all of the interface methods, missing methods will not be called. Note that if the onConnectionCreated method is not implemented it will not be possible to use the created connection in any way.

new ConnectionListener()

This is a dummy constructor not to be used in any case.

Method Summary

onConnectionCreated
Event handler that is called when the connection is created.
onConnectionFailed
Event handler that is called if the connection can't be created.
onLSClient
Event that will be invoked when the embedded LightstreamerClient instance has been created and initialized, but before opening the connection.

Method Detail

onConnectionCreated(connection)

Event handler that is called when the connection is created. This method will never be called if a ConnectionListener#onConnectionFailed event was fired.
Parameters:
Name Type Description
connection Connection The Connection instance representing the current JMS connection.

onConnectionFailed(errorCode, errorMessage)

Event handler that is called if the connection can't be created. The following error codes are used for specific error conditions on the JMS Extender:
  • -13: the JMS Extender configured hook denied acces to the specified user/password pair.
Other possible error codes are the reported in the LightstreamerClient event ClientListener#onServerError, see for more information.
This method will never be called if a ConnectionListener#onConnectionCreated event was fired.
Parameters:
Name Type Description
errorCode Number The code of the error.
errorMessage String The description of the error as sent by the Server.

onLSClient(client)

Event that will be invoked when the embedded LightstreamerClient instance has been created and initialized, but before opening the connection. This is the first event to be fired: it offers the possibility to further customize the LightstreamerClient instance before the connection is issued. It can also be used to attach listeners to the given instance. Note that this method is called synchronously inside the factory methods (i.e. it executes before the create*Connection method ends).
Parameters:
Name Type Description
client LightstreamerClient The client instance that will be used to connect to the JMS Extender.