Interface HealthTrackerRegistry

All Known Implementing Classes:
HealthTrackerRegistryImpl

public interface HealthTrackerRegistry
A registry for the HealthTracker health trackers created per ProjectSubscriptionName.
Since:
2.0.6
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addListener(com.google.cloud.pubsub.v1.Subscriber subscriber)
    Attaches a listener to a Pub/Sub subscriber provided a HealthTracker is registered for that subscription.
    Retrieve all the health trackers registered.
    boolean
    isTracked(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
    Check if a ProjectSubscriptionName has a HealthTracker registered.
    void
    processedMessage(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
    Propagate that a message has been processed to the corresponding HealthTracker if registered.
    registerTracker(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
    Create a tracker for given ProjectSubscriptionName and add tracker to registry.
    registerTracker(String subscriptionName)
    Create a tracker for given subscription name and add tracker to registry.
    default com.google.cloud.pubsub.v1.MessageReceiver
    wrap(com.google.pubsub.v1.ProjectSubscriptionName subscriptionName, com.google.cloud.pubsub.v1.MessageReceiver messageReceiver)
    Wrap a message receiver for a ProjectSubscriptionName.
  • Method Details

    • registerTracker

      HealthTracker registerTracker(String subscriptionName)
      Create a tracker for given subscription name and add tracker to registry.
      Parameters:
      subscriptionName - the subscription name to create a ProjectSubscriptionName using the default project-Id.
      Returns:
      the HealthTracker that has been created and registered.
    • registerTracker

      HealthTracker registerTracker(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
      Create a tracker for given ProjectSubscriptionName and add tracker to registry.
      Parameters:
      projectSubscriptionName - the full subscription name
      Returns:
      the HealthTracker that has been created and registered.
    • isTracked

      boolean isTracked(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
      Check if a ProjectSubscriptionName has a HealthTracker registered.
      Parameters:
      projectSubscriptionName - the full subscription name.
      Returns:
      true if HealthTracker is registered.
    • wrap

      default com.google.cloud.pubsub.v1.MessageReceiver wrap(com.google.pubsub.v1.ProjectSubscriptionName subscriptionName, com.google.cloud.pubsub.v1.MessageReceiver messageReceiver)
      Wrap a message receiver for a ProjectSubscriptionName. A HealthTracker will be created and registered. On a new message received the registered HealthTracker will record its processing.
      Parameters:
      subscriptionName - the full ProjectSubscriptionName name to monitor.
      messageReceiver - the MessageReceiver to wrap.
      Returns:
      messageReceiver the wrapped MessageReceiver.
    • processedMessage

      void processedMessage(com.google.pubsub.v1.ProjectSubscriptionName projectSubscriptionName)
      Propagate that a message has been processed to the corresponding HealthTracker if registered.
      Parameters:
      projectSubscriptionName - the full ProjectSubscriptionName name to monitor.
    • addListener

      void addListener(com.google.cloud.pubsub.v1.Subscriber subscriber)
      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.
      Parameters:
      subscriber - the subscriber to attach a listener.
    • healthTrackers

      Collection<HealthTracker> healthTrackers()
      Retrieve all the health trackers registered.
      Returns:
      all known health trackers