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
ConstructorDescriptionHealthTrackerRegistryImpl
(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 TypeMethodDescriptionvoid
addListener
(com.google.cloud.pubsub.v1.Subscriber subscriber) Attaches a listener to a Pub/Sub subscriber provided aHealthTracker
is registered for that subscription.Retrieve all the health trackers registered.boolean
isTracked
(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Check if aProjectSubscriptionName
has aHealthTracker
registered.void
processedMessage
(com.google.pubsub.v1.ProjectSubscriptionName subscription) Propagate that a message has been processed to the correspondingHealthTracker
if registered.registerTracker
(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName) Create a tracker for givenProjectSubscriptionName
and 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, wait
Methods 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:HealthTrackerRegistry
Create a tracker for given subscription name and add tracker to registry.- Specified by:
registerTracker
in interfaceHealthTrackerRegistry
- Parameters:
subscriptionName
- the subscription name to create aProjectSubscriptionName
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 givenProjectSubscriptionName
and add tracker to registry.- Specified by:
registerTracker
in interfaceHealthTrackerRegistry
- 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 aProjectSubscriptionName
has aHealthTracker
registered.- Specified by:
isTracked
in interfaceHealthTrackerRegistry
- 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 correspondingHealthTracker
if registered.- Specified by:
processedMessage
in interfaceHealthTrackerRegistry
- Parameters:
subscription
- the fullProjectSubscriptionName
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 aHealthTracker
is registered for that subscription. On subscriber termination, the correspondingHealthTracker
shall be removed from the registry.- Specified by:
addListener
in interfaceHealthTrackerRegistry
- Parameters:
subscriber
- the subscriber to attach a listener.
-
healthTrackers
Description copied from interface:HealthTrackerRegistry
Retrieve all the health trackers registered.- Specified by:
healthTrackers
in interfaceHealthTrackerRegistry
- Returns:
- all known health trackers
-