Class ABSwitchCluster

  • All Implemented Interfaces:
    java.util.function.Supplier<java.lang.String>

    public class ABSwitchCluster
    extends java.lang.Object
    implements java.util.function.Supplier<java.lang.String>
    A Supplier for bootstrap servers that can toggle between 2 lists of servers.
    Since:
    2.5
    Author:
    Gary Russell
    • Constructor Summary

      Constructors 
      Constructor Description
      ABSwitchCluster​(java.lang.String primary, java.lang.String secondary)
      Construct an instance with primary and secondary bootstrap servers.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String get()  
      boolean isPrimary()
      Get whether or not the primary cluster is active.
      void primary()
      Use the primary cluster.
      void secondary()
      Use the secondary cluster.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ABSwitchCluster

        public ABSwitchCluster​(java.lang.String primary,
                               java.lang.String secondary)
        Construct an instance with primary and secondary bootstrap servers.
        Parameters:
        primary - the primary.
        secondary - the secondary.
    • Method Detail

      • get

        public java.lang.String get()
        Specified by:
        get in interface java.util.function.Supplier<java.lang.String>
      • isPrimary

        public boolean isPrimary()
        Get whether or not the primary cluster is active.
        Returns:
        true for primary, false for secondary.
      • primary

        public void primary()
        Use the primary cluster.
      • secondary

        public void secondary()
        Use the secondary cluster.