Package com.variant.client
Interface SessionIdTracker
public interface SessionIdTracker
Interface to be implemented by the client, providing external tracking of Variant session IDs. Instead of relying
on the host application's native sessions (which may not even be available), Variant server implements its own
distributed session management. However, Variant server relies on the client code and the host application to provide
tracking of session IDs between state requests. The concrete implementation of this interface depends on the
technology stack of the host application. For example, a webapp will use an HTTP cookie to store the session ID
between page visits or API calls.
By contract, an implementation must provide the constructor with the single parameter of type Object
.
Variant uses this constructor to instantiate a concrete implementation within the scope
of Connection.getSession(Object)
or Connection.getOrCreateSession(Object, Optional)
methods by passing it (without interpretation) as the first parameter.
Configured with the VariantClient.Builder.withSessionIdTrackerClass(Class)
. There is no default implementation.
- Since:
- 0.6
-
Method Summary
Modifier and TypeMethodDescriptionget()
The current value of the session ID tracked by this object, if any.Save the value of session ID tracked by this object to the underlying persistence mechanism.void
Set the value of session ID tracked by this object.
-
Method Details
-
get
The current value of the session ID tracked by this object, if any.- Since:
- 0.6
-
set
Set the value of session ID tracked by this object.- Since:
- 0.6
-
save
Save the value of session ID tracked by this object to the underlying persistence mechanism. Variant client calls this method within the scope of theStateRequest.commit(Object)
orStateRequest.fail(Object)
methods.- Parameters:
userData
- An instance of anyObject
, which Variant client will convey fromStateRequest.commit(Object)
orStateRequest.fail(Object)
methods without interpretation.- Since:
- 0.6
-