Class HealthTrackerImpl

java.lang.Object
com.google.cloud.spring.pubsub.core.health.HealthTrackerImpl
All Implemented Interfaces:
HealthTracker

public class HealthTrackerImpl extends Object implements HealthTracker
Health tracker for a Pub/Sub subscription. The tracker will monitor messages being processed and the subscription's message backlog. If backlog message size exceeds the message backlog threshold, the tracker will return the number of messages over the threshold.
Since:
2.0.6
  • Constructor Details

    • HealthTrackerImpl

      public HealthTrackerImpl(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName, com.google.cloud.monitoring.v3.MetricServiceClient metricServiceClient, Integer lagThreshold, Integer backlogThreshold, Integer lookUpInterval)
  • Method Details

    • processedMessage

      public void processedMessage()
      Description copied from interface: HealthTracker
      Record that a message has been processed.
      Specified by:
      processedMessage in interface HealthTracker
    • subscription

      public com.google.pubsub.v1.ProjectSubscriptionName subscription()
      Description copied from interface: HealthTracker
      Accessor for the Subscription being monitored by the tracker.
      Specified by:
      subscription in interface HealthTracker
      Returns:
      the project subscription name
    • messagesOverThreshold

      public long messagesOverThreshold()
      Description copied from interface: HealthTracker
      If messages have been processed recently returns zero. If no message have been recently processed the tracker will retrieve the number of messages in the subscription backlog. If the backlogs exceeds the threshold the messages over the threshold shall be returned.
      Specified by:
      messagesOverThreshold in interface HealthTracker
      Returns:
      the messages over the threshold