Class ABSwitchCluster

java.lang.Object
org.springframework.kafka.core.ABSwitchCluster
All Implemented Interfaces:
Supplier<String>

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

    • ABSwitchCluster

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

    • get

      public String get()
      Specified by:
      get in interface Supplier<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.