Package com.variant.client
Interface VariantClient
public interface VariantClient
Variant Java client provides Java native bindings for communicating with Variant CVM Server.
Makes no assumptions about the host application other than it is running on a Java VM.
Instantiated with the builder pattern:
protected VariantClient client = VariantClient.build( builder -> builder.withSessionIdTrackerClass(MySessionIdTracker.class) );
An implementation of SessionIdTracker
must be provided.
- Since:
- 0.5
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic VariantClient
build
(Consumer<VariantClient.Builder> func) Factory method for obtaining a new instance ofVariantClient
.Connect to a experiment schema on a Variant server by its URI.
-
Method Details
-
build
Factory method for obtaining a new instance ofVariantClient
. Host application should hold on to and reuse the object returned by this method whenever possible. One instance ofVariantClient
per process is always sufficient.- Returns:
- Instance of the
VariantClient
type. - Since:
- 0.10
-
connectTo
Connect to a experiment schema on a Variant server by its URI. This is the first call a host application makes, after building a new variant client.- Parameters:
uriString
- The URI to the experiment schema formatted as[http|https:]//host[:port]/schema
. If omitted, port 5377 is assumed. For example, to connect to schemaexample
:Connection conn = client.connectTo("http://my.server.com:5377/example")
- Returns:
- An object of type
Connection
. - Throws:
UnknownSchemaException
- if given schema does not exist on the server.- Since:
- 0.7
-