Class CommandsBootstrap

java.lang.Object
app.l2nx.gs.adapter.core.commands.CommandsBootstrap

public final class CommandsBootstrap extends Object
Public factory for the commands consume subsystem. NxAdapter calls start(app.l2nx.gs.adapter.api.rest.MessagingTopics, app.l2nx.gs.adapter.api.rest.KafkaConfig, java.lang.String, java.util.concurrent.Executor, java.util.concurrent.Executor, app.l2nx.gs.adapter.api.spi.NxEvents, app.l2nx.gs.adapter.core.commands.CommandsConsumer.ReplySender, app.l2nx.gs.adapter.core.commands.CommandsConfig) once per connect cycle to wire up the registry + Kafka consumer + daemon thread, returning a CommandsBootstrap.Started bundle carrying the CommandsConsumer (for shutdown + heartbeat) and the NxCommands façade (for ConnectContext.commands()).

Hides CommandTypeRegistry, NxCommandsImpl, CommandContextImpl, and HostExecutorImpl — those are package-private implementation details. Callers depend only on the public NxCommands interface and the CommandsConsumer class.

When MessagingTopics.getCommandsTopic() is unconfigured, this factory still produces an NxCommands façade (so host code's unconditional ctx.commands().on(...) calls succeed) but DOES NOT spawn a Kafka consumer thread. The CommandsConsumer returned in that case is null — the caller (i.e. NxAdapter) treats that as "commands disabled" for heartbeat purposes.

  • Method Details

    • swap

      public static @Nullable CommandsConsumer swap(app.l2nx.gs.adapter.api.spi.NxCommands facade, @Nullable app.l2nx.gs.adapter.api.rest.MessagingTopics messagingTopics, app.l2nx.gs.adapter.api.rest.KafkaConfig kafka, String clientIdBase, @Nullable Executor hostExecutor, Executor ioExecutor, app.l2nx.gs.adapter.api.spi.NxEvents events, CommandsConsumer.ReplySender replySender, @Nullable CommandsConfig config)
      Rebuild the consumer in-place behind an existing NxCommands façade, preserving its registered handlers across reconnect. Modules that captured ctx.commands() from an earlier onConnect keep working with no re-registration.

      Caller MUST stop the previous CommandsConsumer first — this method only creates the new one.

    • start

      public static CommandsBootstrap.Started start(@Nullable app.l2nx.gs.adapter.api.rest.MessagingTopics messagingTopics, app.l2nx.gs.adapter.api.rest.KafkaConfig kafka, String clientIdBase, @Nullable Executor hostExecutor, Executor ioExecutor, app.l2nx.gs.adapter.api.spi.NxEvents events, CommandsConsumer.ReplySender replySender, @Nullable CommandsConfig config)