dev.westyx.nexus package.
Factory
NexusClient.create
NexusClient and performs an initial synchronous sync before returning. Throws NexusInitException wrapping any underlying failure if the initial sync does not succeed. The engine parameter is optional and is intended for testing with MockEngine.
Config / secret / flag getters
All getters callensureFresh() internally, which triggers a background sync if the snapshot is older than config.ttl. They never block on the network call - the stale value is returned immediately while sync runs in the background.
getString
key from the config snapshot, or default if the key is not present or the value is empty.
getBoolean
key. Parses "true" / "false" (case-insensitive strict). Returns default if the key is missing or the value cannot be parsed.
getInt
key. Returns default if the key is missing or the value is not a valid integer.
getDouble
key. Returns default if the key is missing or the value is not a valid double.
getJson
JsonElement value stored in the snapshot for key, or null if not found. Use when the value type is not known at compile time.
getFlag
true if the feature flag key is active, false if it is inactive, or default if the key is not found in the flags snapshot.
getSecret
key from the in-memory snapshot.
Throws:
NexusPublicKeyException- when the client was created with awxp_...keyNexusServiceKindMismatchException- when the service is of kindfrontendNexusSecretNotFoundException- whenkeyis not present in the secrets snapshot
getSecretFilePath
key. Only available for secrets of type file. The file is created during sync and deleted when close() is called.
Throws:
NexusPublicKeyException- when the client was created with awxp_...keyNexusSecretNotFoundException- whenkeyis not a known file-type secret
Write API (v0.5.0)
The write API allows programmatic secret creation and deletion. Available for secret keys only. Using a public key throwsNexusPublicKeyException immediately, before the network call.
setSecret
"text").
NexusPublicKeyException- when the client uses awxp_...keyNexusRateLimitedException- HTTP 429 on write endpointNexusUnauthorizedException- HTTP 401NexusBillingException- HTTP 402 (billing overdue)NexusException- any other error
deleteSecret
NexusPublicKeyException- when the client uses awxp_...keyNexusRateLimitedException- HTTP 429 on write endpointNexusUnauthorizedException- HTTP 401NexusBillingException- HTTP 402 (billing overdue)NexusException- any other error
deleteSecretVersion
NexusPublicKeyException- when the client uses awxp_...keyNexusRateLimitedException- HTTP 429 on write endpointNexusUnauthorizedException- HTTP 401NexusBillingException- HTTP 402 (billing overdue)NexusException- any other error
A/B evaluation
evaluateAB
POST /v1/flags/evaluate-ab. Returns a map of flag key to true/false for the given userId and optional attributes.
NexusAbAddonNotAvailableException- when the A/B testing add-on is not active for this project (HTTP 403)NexusException- for any other non-success HTTP status
Sync
sync
GET /v1/sync. Uses ETag/If-None-Match to skip the response body when nothing has changed (304 Not Modified). Updates the in-memory snapshot atomically on success.
Throws:
NexusUnauthorizedException- HTTP 401NexusBillingException- HTTP 402 (also sets billing-overdue flag and callsobserver.onBillingOverdue())NexusNotFoundException- HTTP 404NexusQuarantinedException- HTTP 429 with quarantine body
Stream
connectStream
sync() call automatically. The stream reconnects with exponential back-off on transient failures.
disconnectStream
streamStatus to DISCONNECTED. Does not affect the background TTL sync or the HTTP client.
streamStatus
StateFlow that reflects the current stream connection state. Possible values:
Lifecycle
close
getSecretFilePath. Call this when the application shuts down. After close(), the client is unusable.