Class NxAdapter

java.lang.Object
app.l2nx.gs.adapter.core.NxAdapter

public final class NxAdapter extends Object
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 Details

    • onStateChange

      public static void onStateChange(Consumer<AdapterState> callback)
      Register a state-transition callback. May be called before or after start(). Replaces any previously registered callback.
    • state

      public static AdapterState state()
      Current adapter state.
    • start

      public static NxAdapter 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 to AdapterState.CLOSED. Safe to call from any thread; safe to call repeatedly.