Class MetadataNodeManager

java.lang.Object
io.confluent.security.store.kafka.coordinator.MetadataNodeManager
All Implemented Interfaces:
MetadataServiceRebalanceListener

public class MetadataNodeManager extends Object implements MetadataServiceRebalanceListener
Node manager for Metadata Service. A Kafka group coordinator is used to manage active nodes and elect a single master writer.
  • Constructor Details

  • Method Details

    • registerWriter

      public void registerWriter(Writer writer)
      Registers a writer with this node manager. Can be called before or after start():
      • Pre-start: the writer joins the registry; the next onAssigned will start it alongside the others.
      • Post-start: the writer is enqueued on the manager-thread so we observe a consistent master state. If we are currently the master writer, startWriter is invoked on the late registrant for the active generation so it doesn't miss the assignment. If we are not master, it just joins the registry — the next onAssigned (or onRevoked) will pick it up.

      Independence requirement. Registered writers must be independent of each other. This manager makes no ordering guarantees on either start or stop.

    • start

      public CompletionStage<Void> start()
    • isMasterWriter

      public boolean isMasterWriter()
    • masterWriterUrl

      public URL masterWriterUrl(String protocol)
    • activeNodeUrls

      public Collection<URL> activeNodeUrls(String protocol)
    • onAssigned

      public void onAssigned(MetadataServiceAssignment assignment, int generationId)
      Description copied from interface: MetadataServiceRebalanceListener
      Assignment completion notification generated when rebalance completes.
      Specified by:
      onAssigned in interface MetadataServiceRebalanceListener
    • onRevoked

      public void onRevoked(int generationId)
      Description copied from interface: MetadataServiceRebalanceListener
      Assignment revocation notification generated when rebalance commences.
      Specified by:
      onRevoked in interface MetadataServiceRebalanceListener
    • onWriterResigned

      public void onWriterResigned(int generationId)
      Description copied from interface: MetadataServiceRebalanceListener
      Writer resignation notification generated by the writer when an error is encountered, cache refresh times out or a generation marker with newer generation is is received. This is used to trigger re-election.
      Specified by:
      onWriterResigned in interface MetadataServiceRebalanceListener
    • close

      public void close(Duration closeTimeout)