apache / apache/pulsar-client-cpp

Add cluster-level automatic failover support (AutoClusterFailover)

Ouverte
#568 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C++
Étoiles
71
Forks
90
Merge moyen
2 h 33 min
PR mergées (30 j)
3

Description

**Summary**

The C++ client does not support cluster-level failover — the ability for a Pulsar client to automatically switch from a primary cluster to a secondary cluster when the primary becomes unavailable.

**Context**

The Java client has supported this since Pulsar 2.10 (May 2022) via `AutoClusterFailover` and `ControlledClusterFailover`, both built on the `ServiceUrlProvider` abstraction. The .NET client (Pulsar.Client) has also independently implemented equivalent functionality via `IServiceInfoProvider`. The C++ client still lacks this capability. Since the C++ client is the foundation for several language bindings (Node.js, Python), this gap propagates across multiple client ecosystems. Adding cluster-level failover here would bring the C++ client to parity with Java and unblock the same capability in downstream clients.

**Proposed Behavior**

1. A `ServiceUrlProvider` (or equivalent) abstraction that allows pluggable URL resolution.
2. An `AutoClusterFailover` implementation that:
- Accepts a primary service URL and one or more secondary service URLs.
- Runs a background probe task at a configurable `checkInterval` (default: 30s).
- Switches to the first healthy secondary if the primary is unreachable for longer than `failoverDelay` (default: 30s).
- Switches back to the primary once it recovers and stays healthy for `switchBackDelay` (default: 60s).
- Supports per-cluster authentication and TLS configuration.

**Use Case**

Pulsar deployments with geo-replication across multiple regions need producer clients to automatically failover to a secondary cluster when their local cluster becomes unavailable, without requiring DNS-level failover or application-level detection logic.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par comparer les implémentations Java de AutoClusterFailover et ControlledClusterFailover ainsi que la conception .NET de IServiceInfoProvider mentionnée dans l’issue. Définissez l’abstraction C++ ServiceUrlProvider et le comportement de failover, notamment les vérifications d’état, les délais, l’authentification et TLS ; le travail est terminé lorsque le basculement du primaire vers le secondaire et la récupération sont couverts par des tests.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp
Domaine
distributed-systems, networking
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.