Cache Sessions in the Solace JCSMP API
If you want to use the Solace JCSMP API to enable your application to be able to send and receive requests for cached messages for a topic of interest, you must create one or more cache session objects in a session. A session can support multiple cache session objects. To create a cache session, create a CacheSession object, which gives you access to the following methods:
cancelCacheRequests()—Cancels any outstanding cache requests that are currently in progress.close()—Closes the cache session, which also cancels any outstanding cache requests.getJCSMPSession()—Retrieves theJCSMPSessionthat created thisCacheSession.getProperties()—Retrieves theCacheSessionPropertiesassociated with this cache session, which likely contain configuration details.isClosed()—Checks if the cache session has been closed, returningtrueif it is closed.sendCacheRequest()—Sends a synchronous cache request message. This method is used to request cached messages based on the provided topic and live data action. There is also an asynchronous version of this function, that uses aCacheRequestListenerto handle results.
For more information about the preceding methods, see the Solace Messaging API for JCSMP reference.
The Solace Cache feature is only available to Sessions connected to an event broker that has implemented Solace Cache.