Working with Session Statistics in the Solace JCSMP API
The Solace JCSMP API provides various statistics for each session, which can be useful when debugging applications. For a list of all supported session statistics, see the see the Solace Messaging API for JCSMP reference.
To get session statistics, use the following:
Session.getSessionStats()—Gets the Session statistics.StatType—Supported named statistics.
The following snippet shows three examples of printing session statistics:
System.out.println("Cache Request=" + result + ", Cached Messages Received=" + session.getSessionStats().getStat(StatType.CACHED_MSGS_RECVED));
System.out.println("Number of messages sent: " + s.getSessionStats().getStat(StatType.TOTAL_MSGS_SENT));
System.out.println("Number of messages received: " + s.getSessionStats().getStat(StatType.TOTAL_MSGS_RECVED));