pulsar-client-cpp
Loading...
Searching...
No Matches
pulsar::AutoClusterFailover::Builder Class Reference

#include <AutoClusterFailover.h>

Public Member Functions

 Builder (ServiceInfo primary, std::vector< ServiceInfo > secondary)
Builder & withCheckInterval (std::chrono::milliseconds interval)
Builder & withFailoverThreshold (uint32_t threshold)
Builder & withSwitchBackThreshold (uint32_t threshold)
AutoClusterFailover build ()

Detailed Description

Builder helps create an AutoClusterFailover configuration.

Example: ServiceInfo primary{...}; std::vector<ServiceInfo> secondaries{...}; AutoClusterFailover provider = AutoClusterFailover::Builder(primary, secondaries) .withCheckInterval(std::chrono::seconds(5)) .withFailoverThreshold(3) .withSwitchBackThreshold(3) .build();

Notes:

  • primary: the preferred cluster to use when available.
  • secondary: ordered list of fallback clusters.
  • checkInterval: frequency of health probes.
  • failoverThreshold: the number of consecutive failed probes required before switching away from the current cluster.
  • switchBackThreshold: the number of consecutive successful probes to the primary required before switching back from a secondary while that secondary remains available. If the active secondary becomes unavailable and the primary is available, the implementation may switch back to the primary immediately, regardless of this threshold.

The documentation for this class was generated from the following file: