Class HealthTrackerRegistryImpl

java.lang.Object
com.google.cloud.spring.pubsub.core.health.HealthTrackerRegistryImpl
All Implemented Interfaces:
HealthTrackerRegistry

public class HealthTrackerRegistryImpl extends Object implements HealthTrackerRegistry
A registry for the HealthTracker health trackers created per ProjectSubscriptionName.
Since:
2.0.6
  • Constructor Details

    • HealthTrackerRegistryImpl

      public HealthTrackerRegistryImpl(String projectId, com.google.cloud.monitoring.v3.MetricServiceClient metricServiceClient, Integer lagThreshold, Integer backlogThreshold, Integer lookUpInterval, com.google.api.gax.core.ExecutorProvider executorProvider)
    • HealthTrackerRegistryImpl

      public HealthTrackerRegistryImpl(String projectId, com.google.cloud.monitoring.v3.MetricServiceClient metricServiceClient, Integer lagThreshold, Integer backlogThreshold, Integer lookUpInterval, com.google.api.gax.core.ExecutorProvider executorProvider, ConcurrentMap<com.google.pubsub.v1.ProjectSubscriptionName,HealthTracker> healthTrackers)
  • Method Details

    • registerTracker

      public HealthTracker registerTracker(String subscriptionName)
      Description copied from interface: HealthTrackerRegistry
      Create a tracker for given subscription name and add tracker to registry.
      Specified by:
      registerTracker in interface HealthTrackerRegistry
      Parameters:
      subscriptionName - the subscription name to create a ProjectSubscriptionName using the default project-Id.
      Returns:
      the HealthTracker that has been created and registered.
    • registerTracker

      public HealthTracker registerTracker(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
      Description copied from interface: HealthTrackerRegistry
      Create a tracker for given ProjectSubscriptionName and add tracker to registry.
      Specified by:
      registerTracker in interface HealthTrackerRegistry
      Parameters:
      projectSubscriptionName - the full subscription name
      Returns:
      the HealthTracker that has been created and registered.
    • isTracked

      public boolean isTracked(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
      Description copied from interface: HealthTrackerRegistry
      Check if a ProjectSubscriptionName has a HealthTracker registered.
      Specified by:
      isTracked in interface HealthTrackerRegistry
      Parameters:
      projectSubscriptionName - the full subscription name.
      Returns:
      true if HealthTracker is registered.
    • processedMessage

      public void processedMessage(com.google.pubsub.v1.ProjectSubscriptionName subscription)
      Description copied from interface: HealthTrackerRegistry
      Propagate that a message has been processed to the corresponding HealthTracker if registered.
      Specified by:
      processedMessage in interface HealthTrackerRegistry
      Parameters:
      subscription - the full ProjectSubscriptionName name to monitor.
    • addListener

      public void addListener(com.google.cloud.pubsub.v1.Subscriber subscriber)
      Description copied from interface: HealthTrackerRegistry
      Attaches a listener to a Pub/Sub subscriber provided a HealthTracker is registered for that subscription. On subscriber termination, the corresponding HealthTracker shall be removed from the registry.
      Specified by:
      addListener in interface HealthTrackerRegistry
      Parameters:
      subscriber - the subscriber to attach a listener.
    • healthTrackers

      public Collection<HealthTracker> healthTrackers()
      Description copied from interface: HealthTrackerRegistry
      Retrieve all the health trackers registered.
      Specified by:
      healthTrackers in interface HealthTrackerRegistry
      Returns:
      all known health trackers