Class HealthTrackerRegistryImpl
java.lang.Object
com.google.cloud.spring.pubsub.core.health.HealthTrackerRegistryImpl
- All Implemented Interfaces:
HealthTrackerRegistry
A registry for the
HealthTracker health trackers created per ProjectSubscriptionName.- Since:
- 2.0.6
-
Constructor Summary
ConstructorsConstructorDescriptionHealthTrackerRegistryImpl(String projectId, com.google.cloud.monitoring.v3.MetricServiceClient metricServiceClient, Integer lagThreshold, Integer backlogThreshold, Integer lookUpInterval, com.google.api.gax.core.ExecutorProvider executorProvider) 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 Summary
Modifier and TypeMethodDescriptionvoidaddListener(com.google.cloud.pubsub.v1.Subscriber subscriber) Attaches a listener to a Pub/Sub subscriber provided aHealthTrackeris registered for that subscription.Retrieve all the health trackers registered.booleanisTracked(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Check if aProjectSubscriptionNamehas aHealthTrackerregistered.voidprocessedMessage(com.google.pubsub.v1.ProjectSubscriptionName subscription) Propagate that a message has been processed to the correspondingHealthTrackerif registered.registerTracker(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Create a tracker for givenProjectSubscriptionNameand add tracker to registry.registerTracker(String subscriptionName) Create a tracker for given subscription name and add tracker to registry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.cloud.spring.pubsub.core.health.HealthTrackerRegistry
wrap
-
Constructor Details
-
HealthTrackerRegistryImpl
-
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
Description copied from interface:HealthTrackerRegistryCreate a tracker for given subscription name and add tracker to registry.- Specified by:
registerTrackerin interfaceHealthTrackerRegistry- Parameters:
subscriptionName- the subscription name to create aProjectSubscriptionNameusing the default project-Id.- Returns:
- the
HealthTrackerthat has been created and registered.
-
registerTracker
public HealthTracker registerTracker(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Description copied from interface:HealthTrackerRegistryCreate a tracker for givenProjectSubscriptionNameand add tracker to registry.- Specified by:
registerTrackerin interfaceHealthTrackerRegistry- Parameters:
projectSubscriptionName- the full subscription name- Returns:
- the
HealthTrackerthat has been created and registered.
-
isTracked
public boolean isTracked(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Description copied from interface:HealthTrackerRegistryCheck if aProjectSubscriptionNamehas aHealthTrackerregistered.- Specified by:
isTrackedin interfaceHealthTrackerRegistry- Parameters:
projectSubscriptionName- the full subscription name.- Returns:
- true if
HealthTrackeris registered.
-
processedMessage
public void processedMessage(com.google.pubsub.v1.ProjectSubscriptionName subscription) Description copied from interface:HealthTrackerRegistryPropagate that a message has been processed to the correspondingHealthTrackerif registered.- Specified by:
processedMessagein interfaceHealthTrackerRegistry- Parameters:
subscription- the fullProjectSubscriptionNamename to monitor.
-
addListener
public void addListener(com.google.cloud.pubsub.v1.Subscriber subscriber) Description copied from interface:HealthTrackerRegistryAttaches a listener to a Pub/Sub subscriber provided aHealthTrackeris registered for that subscription. On subscriber termination, the correspondingHealthTrackershall be removed from the registry.- Specified by:
addListenerin interfaceHealthTrackerRegistry- Parameters:
subscriber- the subscriber to attach a listener.
-
healthTrackers
Description copied from interface:HealthTrackerRegistryRetrieve all the health trackers registered.- Specified by:
healthTrackersin interfaceHealthTrackerRegistry- Returns:
- all known health trackers
-