Class ClusterSnapshotPublisher

All Implemented Interfaces:
SnapshotPublisher

public class ClusterSnapshotPublisher extends ThresholdSnapshotPublisher
Concrete ThresholdSnapshotPublisher that builds a ClusterSnapshot from the local FailoverMetricsSnapshotService and delivers it via a SnapshotPushClient.

Inherits time-threshold gating from ThresholdSnapshotPublisher (at most one push per intervalSeconds) and event-driven dispatch from AbstractSnapshotPublisher (async, virtual-thread executor injected by autoconfiguration; no push when the app is idle).

Owns backoff state: on first failure a single WARN is emitted and push() becomes a no-op until retryIntervalSeconds elapses. On recovery an INFO is logged. Has no dependency on any specific HTTP client — the transport is injected via SnapshotPushClient.

Author:
Anand Manissery
  • Constructor Details

    • ClusterSnapshotPublisher

      public ClusterSnapshotPublisher(FailoverMetricsSnapshotService metricsService, FailoverConfigSnapshotService configSnapshotService, InstanceIdResolver instanceIdResolver, SnapshotPushClient pushClient, String publishUrl, int intervalSeconds, int retryIntervalSeconds, Executor executor)
      Creates a new publisher.
      Parameters:
      metricsService - source of this instance's metrics snapshot
      configSnapshotService - source of this instance's @Failover configuration
      instanceIdResolver - resolves this instance's identity for the pushed snapshot
      pushClient - transport used to deliver the snapshot
      publishUrl - the dashboard's ingest endpoint URL (used only for logging here)
      intervalSeconds - minimum interval between pushes
      retryIntervalSeconds - backoff duration after a push failure
      executor - executor used to dispatch pushes off the metric-event thread
  • Method Details

    • push

      public void push()
      Description copied from interface: SnapshotPublisher
      Pushes the current snapshot to the receiver; must never throw.