Class SyncServerBuilder
SyncServer
and allows to set additional configuration.-
Constructor Summary
ConstructorsConstructorDescriptionSyncServerBuilder
(BoxStore boxStore, String url, SyncCredentials authenticatorCredentials) UseSync.server(BoxStore, String, SyncCredentials)
instead.SyncServerBuilder
(BoxStore boxStore, String url, SyncCredentials[] multipleAuthenticatorCredentials) UseSync.server(BoxStore, String, SyncCredentials)
instead. -
Method Summary
Modifier and TypeMethodDescriptionauthenticatorCredentials
(SyncCredentials authenticatorCredentials) Adds additional authenticator credentials to authenticate clients or peers with.build()
Builds and returns a Sync server ready toSyncServer.start()
.Builds,starts
and returns a Sync server.certificatePath
(String certificatePath) Sets the path to a directory that contains a cert.pem and key.pem file to use to establish encrypted connections.changeListener
(SyncChangeListener changeListener) Sets a listener to observe fine granular changes happening during sync.clusterFlags
(int flags) Sets bit flags to configure the cluster behavior of the Sync server (aka cluster peer).Enables cluster mode (requires the Cluster feature) and associates this cluster peer with the given ID.clusterPeer
(String url, SyncCredentials credentials) Adds a (remote) cluster peer, to which this server should connect to as a client using the given credentials.historySizeMaxKb
(long historySizeMaxKb) Sets the maximum transaction history size.historySizeTargetKb
(long historySizeTargetKb) Sets the target transaction history size.jwtClaimAud
(String claimAud) Sets the JWT claim "aud" (audience) used to verify JWT tokens.jwtClaimIss
(String claimIss) Sets the JWT claim "iss" (issuer) used to verify JWT tokens.jwtPublicKey
(String publicKey) Sets the public key used to verify JWT tokens.jwtPublicKeyUrl
(String publicKeyUrl) Sets the JWKS (Json Web Key Sets) URL to fetch the current public key used to verify JWT tokens.Deprecated.peer
(String url, SyncCredentials credentials) Deprecated.UseclusterPeer(String, SyncCredentials)
instead.syncFlags
(int syncFlags) Sets bit flags to adjust Sync behavior, like additional logging.syncServerFlags
(int syncServerFlags) Sets bit flags to configure the Sync server.workerThreads
(int workerThreads) Sets the number of workers for the main task pool.
-
Constructor Details
-
SyncServerBuilder
@Internal public SyncServerBuilder(BoxStore boxStore, String url, SyncCredentials authenticatorCredentials) UseSync.server(BoxStore, String, SyncCredentials)
instead. -
SyncServerBuilder
@Internal public SyncServerBuilder(BoxStore boxStore, String url, SyncCredentials[] multipleAuthenticatorCredentials) UseSync.server(BoxStore, String, SyncCredentials)
instead.
-
-
Method Details
-
certificatePath
Sets the path to a directory that contains a cert.pem and key.pem file to use to establish encrypted connections.Use the "wss://" protocol for the server URL to turn on encrypted connections.
-
authenticatorCredentials
Adds additional authenticator credentials to authenticate clients or peers with.For the embedded server, currently only
SyncCredentials.sharedSecret(java.lang.String)
, any JWT method likeSyncCredentials.jwtIdTokenServer()
as well asSyncCredentials.none()
are supported. -
changeListener
Sets a listener to observe fine granular changes happening during sync.This listener can also be
set or removed
on the Sync server directly. -
clusterId
Enables cluster mode (requires the Cluster feature) and associates this cluster peer with the given ID.Cluster peers need to share the same ID to be in the same cluster.
-
peer
Deprecated.UseclusterPeer(url, SyncCredentials.none())
instead. -
peer
Deprecated.UseclusterPeer(String, SyncCredentials)
instead. -
clusterPeer
Adds a (remote) cluster peer, to which this server should connect to as a client using the given credentials.To use this, must set a
clusterId(String)
. -
clusterFlags
Sets bit flags to configure the cluster behavior of the Sync server (aka cluster peer).To use this, must set a
clusterId(String)
.- Parameters:
flags
- One or more ofClusterFlags
.
-
historySizeMaxKb
Sets the maximum transaction history size.Once the maximum size is reached, old transaction logs are deleted to stay below this limit. This is sometimes also called "history pruning" in the context of Sync.
If not set or set to 0, defaults to no limit.
- See Also:
-
historySizeTargetKb
Sets the target transaction history size.Once the maximum size (
historySizeMaxKb(long)
) is reached, old transaction logs are deleted until this size target is reached (lower than the maximum size). Using this target size typically lowers the frequency of history pruning and thus may improve efficiency.If not set or set to 0, defaults to
historySizeMaxKb(long)
. -
syncFlags
Sets bit flags to adjust Sync behavior, like additional logging.- Parameters:
syncFlags
- One or more ofSyncFlags
.
-
syncServerFlags
Sets bit flags to configure the Sync server.- Parameters:
syncServerFlags
- One or more ofSyncServerFlags
.
-
workerThreads
Sets the number of workers for the main task pool.If not set or set to 0, this uses a hardware-dependant default, e.g. 3 * CPU "cores".
-
jwtPublicKey
Sets the public key used to verify JWT tokens.The public key should be in the PEM format.
However, typically the key is supplied using a JWKS file served from a
jwtPublicKeyUrl(String)
.See
jwtPublicKeyUrl(String)
for a common configuration to enable JWT auth. -
jwtPublicKeyUrl
Sets the JWKS (Json Web Key Sets) URL to fetch the current public key used to verify JWT tokens.A working JWT configuration can look like this:
See the JWT authentication documentation for details.SyncCredentials auth = SyncCredentials.jwtIdTokenServer(); SyncServer server = Sync.server(store, url, auth) .jwtPublicKeyUrl("https://example.com/public-key") .jwtClaimAud("<audience>") .jwtClaimIss("<issuer>") .build();
-
jwtClaimIss
Sets the JWT claim "iss" (issuer) used to verify JWT tokens.- See Also:
-
jwtClaimAud
Sets the JWT claim "aud" (audience) used to verify JWT tokens.- See Also:
-
build
Builds and returns a Sync server ready toSyncServer.start()
.Note: this clears all previously set authenticator credentials.
-
buildAndStart
Builds,starts
and returns a Sync server.
-
clusterPeer(url, SyncCredentials.none())
instead.