Class HealthTrackerImpl
java.lang.Object
com.google.cloud.spring.pubsub.core.health.HealthTrackerImpl
- All Implemented Interfaces:
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
-
Field Summary
Fields inherited from interface com.google.cloud.spring.pubsub.core.health.HealthTracker
UNDELIVERED_FILTER_TEMPLATE
-
Constructor Summary
ConstructorDescriptionHealthTrackerImpl
(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName, com.google.cloud.monitoring.v3.MetricServiceClient metricServiceClient, Integer lagThreshold, Integer backlogThreshold, Integer lookUpInterval) -
Method Summary
Modifier and TypeMethodDescriptionlong
If messages have been processed recently returns zero.void
Record that a message has been processed.com.google.pubsub.v1.ProjectSubscriptionName
Accessor for the Subscription being monitored by the tracker.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.HealthTracker
undeliveredFilter
-
Constructor Details
-
HealthTrackerImpl
-
-
Method Details
-
processedMessage
public void processedMessage()Description copied from interface:HealthTracker
Record that a message has been processed.- Specified by:
processedMessage
in interfaceHealthTracker
-
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 interfaceHealthTracker
- 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 interfaceHealthTracker
- Returns:
- the messages over the threshold
-