public interface CacheSession
Modifier and Type | Method and Description |
---|---|
void |
cancelCacheRequests()
Cancels outstanding cache requests.
|
void |
close()
Closes the cache session and cancels any outstanding cache requests.
|
JCSMPSession |
getJCSMPSession()
Gets the JCSMPSession that created this CacheSession.
|
CacheSessionProperties |
getProperties()
Gets the properties for this Session.
|
boolean |
isClosed()
Returns true if this cache session has been closed.
|
CacheRequestResult |
sendCacheRequest(Long requestId,
Topic topic,
boolean subscribe,
CacheLiveDataAction liveDataAction)
Send a synchronous cache request message.
|
void |
sendCacheRequest(Long requestId,
Topic topic,
boolean subscribe,
CacheLiveDataAction liveDataAction,
CacheRequestListener listener)
Send an asynchronous cache request message.
|
JCSMPSession getJCSMPSession()
CacheSessionProperties getProperties()
void close()
ClosedFacilityException
.boolean isClosed()
ClosedFacilityException
.void cancelCacheRequests()
JCSMPInterruptedException
.
CacheRequestListener
s of outstanding asynchronous cache requests will have their
CacheRequestListener.onException(Long, Topic, JCSMPException)
method called
with a JCSMPException of JCSMPInterruptedException
.CacheRequestResult sendCacheRequest(Long requestId, Topic topic, boolean subscribe, CacheLiveDataAction liveDataAction) throws JCSMPException
liveDataAction
handling options.
Cached messages received in response to the cache request are delivered to the application through the usual receive message callback as the messages arrive. When all cache responses have been received, the request is completed by live data, or the request is completed by timeout, this function returns.
Attempts to send a cache request on a closed cache session will throw a
ClosedFacilityException
.
Note: Upon request completion, the API does not guarantee that delivery of the last message to the receive message callback and returning from this call will happen in any particular order, as the events are triggered by different threads.
Note: Irrespective of whether the cache request is synchronous or asynchronous, cache requests may be flow controlled if the underlying transport is flow controlled. The transport is considered flow controlled if the library is unable to write to transport device (for example, the TCP socket is full). This will cause the operation to block.
requestId
- The Request ID to set in cached messages received.topic
- The Topic to get cache data for.subscribe
- Set this to True to subscribe first to the given Topic before
performing a cache request.liveDataAction
- The action to perform on receiving live data on the given
Topic.JCSMPException
- If there was an error executing the cache request.void sendCacheRequest(Long requestId, Topic topic, boolean subscribe, CacheLiveDataAction liveDataAction, CacheRequestListener listener) throws JCSMPException
Cached messages received in response to the cache request are delivered
to the application through the usual receive message callback as the
messages arrive. When all cache responses have been received, the request
is completed by live data, or the request is completed by timeout, the
listener
is invoked to indicate completion.
Note: Upon request completion, the API does not
guarantee that delivery of the last message to the receive message
callback and the invocation of the listener
callback will
happen in any particular order, as the events are triggered by different
threads.
Attempts to send a cache request on a closed cache session will throw a
ClosedFacilityException
.
Note: Irrespective of whether the cache request is synchronous or asynchronous, cache requests may be flow controlled if the underlying transport is flow controlled. The transport is considered flow controlled if the library is unable to write to transport device (for example, the TCP socket is full). This will cause the operation to block.
requestId
- The Request ID to set in cached messages received, and used in
the CacheRequestListener.topic
- The Topic to get cache data for.subscribe
- Set this to True to subscribe first to the given Topic before
performing a cache request.liveDataAction
- Action to perform on receiving live data on the given Topic.listener
- The listener that will be notified of the cache request's
completion status.JCSMPException
- If there was an error in the passed parameters.
Copyright 2004-2024 Solace Corporation. All rights reserved.