Package app.l2nx.gs.adapter.core
Class NxAdapter
java.lang.Object
app.l2nx.gs.adapter.core.NxAdapter
Adapter entry point — singleton-style facade exposing the lifecycle to the host JVM.
Usage:
NxAdapter.onStateChange(s -> log.info("adapter state: {}", s)); // optional
NxAdapter.start(); // fire-and-forget
start() never propagates an exception to the host JVM. Any failure during
config resolution is caught here, logged via NxLog, and reflected in
state() as AdapterState.FAILED.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidonStateChange(Consumer<AdapterState> callback) Register a state-transition callback.voidshutdown()Idempotent shutdown — cancel heartbeat, cancel connect scheduler, shut down the Kafka client if alive, and transition toAdapterState.CLOSED.static NxAdapterstart()Resolve config and (if enabled) initiate the connect flow on a daemon scheduler.static AdapterStatestate()Current adapter state.
-
Method Details
-
onStateChange
Register a state-transition callback. May be called before or afterstart(). Replaces any previously registered callback. -
state
Current adapter state. -
start
Resolve config and (if enabled) initiate the connect flow on a daemon scheduler. Non-blocking — returns immediately. Never throws into the host JVM. -
shutdown
public void shutdown()Idempotent shutdown — cancel heartbeat, cancel connect scheduler, shut down the Kafka client if alive, and transition toAdapterState.CLOSED. Safe to call from any thread; safe to call repeatedly.
-