Class EventsBootstrap

java.lang.Object
app.l2nx.gs.adapter.core.events.EventsBootstrap

public final class EventsBootstrap extends Object
Public factory for the events publish subsystem. NxAdapter calls start(Map, EventsPublisher.Sender, EventsPublisher.ProducerFlusher, EventsConfig) once per connect cycle to wire up the bounded queue + daemon thread + registry, returning a EventsBootstrap.Started bundle with the EventsPublisher (for shutdown + heartbeat status) and the NxEvents façade (for ConnectContext.events()).

Hides EventTypeRegistry and NxEventsImpl — those are package-private implementation details. Callers depend only on the public NxEvents interface and the EventsPublisher class.

  • Method Details

    • start

      public static EventsBootstrap.Started start(@Nullable Map<String,String> familyTopics, EventsPublisher.Sender sender, EventsPublisher.ProducerFlusher producerFlusher, EventsConfig config)
      Materializes the registry, instantiates the publisher, starts its daemon thread, and wraps the publisher in an NxEvents façade.
      Parameters:
      familyTopics - per-family Kafka topic map from MessagingTopics.events; null or empty disables every publish call (no-op + DEBUG log).
      sender - Kafka send bridge — production wires this to NxKafka.instance()::sendBytesKeyRecord.
      producerFlusher - synchronous producer-flush bridge — production wires this to NxKafka.instance()::flush; backs NxEvents.flush(timeoutMs).
      config - operator-tunable knobs (queue capacity, drop policy, shutdown drain).
    • swap

      public static EventsPublisher swap(app.l2nx.gs.adapter.api.spi.NxEvents facade, @Nullable Map<String,String> familyTopics, EventsPublisher.Sender sender, EventsPublisher.ProducerFlusher producerFlusher, EventsConfig config)
      Rebuild the publisher in-place behind a stable NxEvents façade. Used on reconnect — modules that captured ctx.events() from an earlier onConnect keep publishing into the new publisher with no re-registration.