Skip to main content
Every public symbol exported by dev.westyx.nexus.*. The auto-configuration creates the NexusClient bean and starts the SSE stream - for most users, the read methods (getConfig, getFlag, getSecret) are the entire API surface.

Construction

NexusClient.create(NexusConfig config)

Creates a client and runs a blocking initial sync. Used internally by the auto-configuration; rarely called directly.

Configs

Optional<JsonNode> getConfig(String key)

Returns the resolved config value as a Jackson JsonNode (the wire-decoded JSON), or Optional.empty() when the key is absent.

<T> Optional<T> getConfigAs(String key, Class<T> type)

Returns the config value coerced to the given type, using Jackson’s treeToValue.

Map<String, JsonNode> getAllConfigs()

Snapshot copy of every config key-value pair currently in the cache. public-key clients see only is_public: true entries.

Feature flags

boolean getFlag(String key) / boolean getFlag(String key, boolean defaultValue)

Returns the is_active state of a flag, or defaultValue (default false) when the key is absent.

Map<String, Boolean> getAllFlags()

Snapshot copy of every flag key-is_active pair in the cache.

AB Testing (v0.3.0)

Map<String, Boolean> evaluateAB(List<String> keys, String userId, Map<String, Object> attributes)

Batch-evaluates feature flags with AB Testing semantics. Posts to POST /v1/flags/evaluate-ab and returns the server’s results map verbatim. Unlike getFlag, this method always makes a network call. The call is blocking; run it off the request thread if your handler is latency-sensitive.
Requires the AB Testing add-on to be active on the project; otherwise the server returns HTTP 403.

Secrets (secret key only)

String getSecret(String key)

Returns the plaintext value of a secret.

Optional<String> getSecretFilePath(String key) (v0.3.0)

Returns the absolute path to the on-disk file where the SDK has materialised a type="file" secret, or Optional.empty() when the key is unknown or the secret is of type="text".

Write API (v0.5.0)

The write API allows programmatic secret creation and deletion. Available for secret keys only. Using a public key throws NexusPublicKeyException immediately, before the network call.

void setSecret(String key, String value)

Creates or updates a secret with the given key and plaintext value. The secret defaults to type="text".

void deleteSecret(String key)

Deletes a secret and all its versions.

void deleteSecretVersion(String key, int version)

Deletes a specific version of a secret.

Metadata

Sync / lifecycle

void sync()

Forces a sync now, bypassing the TTL. Atomically replaces the cache. ETag / If-None-Match is used automatically; a 304 resets the TTL without downloading data. Rarely needed.

void connectStream() / void disconnectStream()

Start/stop the SSE thread. The auto-configuration calls connectStream() automatically (unless nexus.stream=false). Idempotent.

void close()

Stops the SSE thread, removes any temp files created for type="file" secrets, and releases the SDK-owned HTTP clients. The auto-configuration registers this as the bean’s destroy method (destroyMethod = "close"), so it fires automatically on Spring context shutdown. NexusClient implements AutoCloseable, so try-with-resources also works:

Exception hierarchy

All concrete exceptions extend NexusException. See Error handling for full semantics.

Logger SPI

The auto-configuration installs an SLF4J-backed adapter writing to the logger named dev.westyx.nexus.NexusClient. To override, register your own NexusLogger bean.