Class CommandsBootstrap
java.lang.Object
app.l2nx.gs.adapter.core.commands.CommandsBootstrap
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, 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classTuple of theNxCommandsfaçade and the optionalCommandsConsumer. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandsBootstrap.Startedstart(@Nullable app.l2nx.gs.adapter.api.rest.MessagingTopics messagingTopics, app.l2nx.gs.adapter.api.rest.KafkaConfig kafka, String clientIdBase, @Nullable Executor hostExecutor, app.l2nx.gs.adapter.api.spi.NxEvents events, CommandsConsumer.ReplySender replySender, @Nullable CommandsConfig config) Wire up the registry, theNxCommandsfaçade, and (whenmessagingTopics.commandsTopicis configured) a Kafka consumer + daemon thread.
-
Method Details
-
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, app.l2nx.gs.adapter.api.spi.NxEvents events, CommandsConsumer.ReplySender replySender, @Nullable CommandsConfig config) Wire up the registry, theNxCommandsfaçade, and (whenmessagingTopics.commandsTopicis configured) a Kafka consumer + daemon thread. Returns aCommandsBootstrap.Startedbundle.- Parameters:
messagingTopics- the platform-issued addressing bundle; may benull(treated as commands disabled).kafka- platform-issued Kafka config; provides brokers, SASL credentials, etc.clientIdBase- base client id (e.g.nx-gs-adapter-<tenant>-<server>); the commands consumer appends-commands.hostExecutor- host's game-sideExecutor; may benullwhen host code has not registered one — handlers requiringctx.host().sync(...)will then throwIllegalStateExceptionon first hop.events- theNxEventsfaçade so handlers can publish side-effect events.replySender- the bridge to the actual Kafka send (production wires this toNxKafka.sendBytesKeyRecord).config- operator-tunable knobs; falls back toCommandsConfig.defaults()whennull.
-