Skip to main content
nexus-ktor-plugin installs a NexusClient into a Ktor server application and ties it to the application’s lifecycle. It is a separate artifact, so a consumer that does not run Ktor never resolves ktor-server-core.

Installation

Usage

Application.nexus returns the installed client. Without the plugin it raises an IllegalStateException naming the installation call rather than a bare missing-attribute error. There is also installNexus { … } as a shorthand for install(Nexus) { … }.

Configuration

Everything else behaves exactly as in Configuration - the plugin builds a NexusConfig from these fields.

Lifecycle

Startup. The client is created, and performs its initial sync, while the plugin installs. A bad endpoint, a rejected key or an unresolvable WIF credential therefore fails embeddedServer(...).start() rather than surfacing as a 500 on whichever request first happens to touch a config. If connectStream is true, the live-update stream opens here too. Shutdown. On ApplicationStopping the plugin closes the client, which cancels the stream, releases both HTTP clients and the WIF credential source, and removes any materialised file secrets. This is the plugin’s main reason to exist: a stream coroutine that outlives the application would hold a connection and a thread pool open in a process that believes it has shut down. The plugin’s test suite asserts that streamStatus is DISCONNECTED and the client is closed once the application has stopped.
Because installation performs a suspending initial sync in a non-suspending Ktor hook, it blocks the startup thread until the sync completes. That is deliberate: application startup is synchronous, and fail-fast is the point.

Accessing the client outside a route