SDK
SDK Java v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

Constructor #

This is the main entry point to communicate with Kuzzle.
Each instance represent a connection to Kuzzle with specific options.

Signature #

Kuzzle(String host)
Kuzzle(String host, io.kuzzle.sdk.Options options)

Arguments #

ArgumentTypeDescriptionRequired
hostStringThe target Kuzzle hostyes
optionsio.kuzzle.sdk.OptionsKuzzle connection configurationyes

host #

The Kuzzle host to connect to.
Can be a hostname or an IP address.

options #

OptionTypeDescriptionDefaultRequired
autoQueuebooleanAutomatically queue all requests during offline modefalseno
autoReconnectbooleanAutomatically reconnect after a connection losstrueno
autoReplaybooleanAutomatically replay queued requests on a reconnected eventfalseno
autoResubscribebooleanAutomatically renew all subscriptions on a reconnected eventtrueno
offlineModeModeOffline mode configuration. MANUAL or AUTOMANUALno
queueTTLintTime a queued request is kept during offline mode, in milliseconds120000no
queueMaxSizeintNumber of maximum requests kept during offline mode500no
replayIntervalDurationDelay between each replayed requests, in milliseconds10no
reconnectionDelayDurationnumber of milliseconds between reconnection attempts1000no
sslConnectionbooleanSwitch Kuzzle connection to SSL modefalseno
volatileVolatileDataCommon volatile data, will be sent to all future requests-no

Notes:

  • if queueTTL is set to 0, requests are kept indefinitely
  • The offline buffer acts like a first-in first-out (FIFO) queue, meaning that if the queueMaxSize limit is reached, older requests are discarded to make room for new requests
  • if queueMaxSize is set to 0, an unlimited number of requests is kept until the buffer is flushed
  • multiple methods allow passing specific volatile data. These volatile data will be merged with the global Kuzzle volatile object when sending the request, with the request specific volatile taking priority over the global ones.

Getter & Setter #

The properties can be writable.
For example, you can read the volatile property via getVolatile() and set it via setVolatile().

Property nameTypeDescriptionAvailability
autoReplaybooleanAutomatically replay queued requests on a reconnected eventSet
jwtStringToken used in requests for authentication.Get
volatileStringCommon volatile data in JSON format, will be sent to all future requestsGet/Set

Return #

A io.kuzzle.sdk.Kuzzle instance.

Usage #

Options options = new Options();
options.setAutoResubscribe(false);
WebSocket ws = new WebSocket("kuzzle");
Kuzzle kuzzle = new Kuzzle(ws, options);