Handling Session Events in the PubSub+ JCSMP API

In the PubSub+ JCSMP API, session events and channel reconnect events provide insights into the state of the connection between a client application and the PubSub+ event broker. These events enable you to monitor connection health, detect disruptions, and handle reconnection logic in your applications.

  • Session Events

    An application can register an implementation of the SessionEventHandler interface when creating a Session through JCSMPFactory#createSession(JCSMPProperties, Context, SessionEventHandler). This handler receives callbacks for Session events defined in SessionEvent.

  • Channel Reconnect Events

    An application that uses the Session’s default message consumer (acquired through JCSMPSession#getMessageConsumer()), can register a JCSMPReconnectEventHandler instance when acquiring that consumer. This handler receives callbacks before and after the client’s TCP connection is reconnected after a connection failure.

For an example of how to configure a session event handler for JCSMP, see SampleUtils.java in the Solace Developer Hub.