Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc update for Spring Pub/Sub subscriber health check setup #2470

Closed
AvocadoSushi123 opened this issue Dec 15, 2023 · 0 comments · Fixed by #2861
Closed

Doc update for Spring Pub/Sub subscriber health check setup #2470

AvocadoSushi123 opened this issue Dec 15, 2023 · 0 comments · Fixed by #2861
Assignees
Labels
documentation Improvements or additions to documentation priority: p2 type: enhancement New feature or request

Comments

@AvocadoSushi123
Copy link

AvocadoSushi123 commented Dec 15, 2023

Describe the bug
we recently enabled Pub/Sub subscriber health check for our spring boot application. In the doc: https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/pubsub.html#_cloud_pubsub_subscription_health_indicator, it is not quite clear how the subscriber healthcheck knows the subscription name.

We use PubSubInboundChannel to integrate with Pub/Sub (https://cloud.spring.io/spring-cloud-static/Greenwich.RELEASE/multi/multi__spring_integration.html). After some investigation in the library code, I found out the lib has an auto-configured bean for healthTrackerRegistry, and we need to set the healthTrackerRegistry in the PubSubInboundChannelAdapter in order to make the subscriber healthcheck work.

I don't see this mentioned in the doc, and I thought the spring.cloud.gcp.pubsub.health.subscription is the subscriber name for the health check and it would only check if the service receives 404 or 403 if this value is not set (the configuration for both pubsub and pubsub-subscriber healthcheck are allocated together ). It would be great if the doc can be updated with more instruction to set up the pub/sub subscription health check.

Sample

application.yaml

...
gcp:
      pubsub:
        health:
          lagThreshold: 600
          backlogThreshold: 10
          lookUpInterval: 60
...

PubSubListener.java

...
  @Bean
  public PubSubInboundChannelAdapter adapterBean(
      @NonNull MessageChannel inputChannel,
      @NonNull HealthTrackerRegistry healthTrackerRegistry,
      @NonNull PubSubTemplate pubSubTemplate) {
    PubSubInboundChannelAdapter adapter =
        new PubSubInboundChannelAdapter(
            pubSubTemplate, "subscription-name");
    adapter.setOutputChannel(inputChannel);
    adapter.setPayloadType(Message.class);
    adapter.setHealthTrackerRegistry(healthTrackerRegistry);
    return adapter;
  }
@AvocadoSushi123 AvocadoSushi123 changed the title Doc update for Spring Pub/Sub subscriber health check set up Doc update for Spring Pub/Sub subscriber health check setup Dec 15, 2023
@mpeddada1 mpeddada1 added documentation Improvements or additions to documentation type: enhancement New feature or request priority: p2 labels Dec 15, 2023
@zhumin8 zhumin8 self-assigned this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation priority: p2 type: enhancement New feature or request
Projects
None yet
3 participants