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

PubSub message conversion exception is silently swallowed #2696

Open
minogin opened this issue Mar 13, 2024 · 0 comments
Open

PubSub message conversion exception is silently swallowed #2696

minogin opened this issue Mar 13, 2024 · 0 comments
Labels
priority: p2 type: bug Something isn't working

Comments

@minogin
Copy link

minogin commented Mar 13, 2024

com.google.cloud:spring-cloud-gcp-pubsub:5.0.4

When using com.google.cloud.spring.pubsub.core.subscriber.PubSubSubscriberTemplate#pullAndConvertAsync and an exception happens during message conversion the future just never completes and you never get neither exception nor the message.

@Override
  public <T> CompletableFuture<List<ConvertedAcknowledgeablePubsubMessage<T>>> pullAndConvertAsync(
      String subscription, Integer maxMessages, Boolean returnImmediately, Class<T> payloadType) {
    final CompletableFuture<List<ConvertedAcknowledgeablePubsubMessage<T>>> completableFuture =
        new CompletableFuture<>();

    this.pullAsync(subscription, maxMessages, returnImmediately)
        .whenComplete(
            (ackableMessages, exception) -> {
                if (exception != null) {
                  completableFuture.completeExceptionally(exception);
                  return;
                }
                completableFuture.complete(
                    this.toConvertedAcknowledgeablePubsubMessages(payloadType, ackableMessages));
            });

    return completableFuture;
  }

The problem is here:

completableFuture.complete(
                    this.toConvertedAcknowledgeablePubsubMessages(payloadType, ackableMessages));

when toConvertedAcknowledgeablePubsubMessages throws an exception.

@burkedavison burkedavison added type: bug Something isn't working priority: p2 labels Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants