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

Subscribers don't reconnect to the subscription when there is no traffic #2599

Closed
ArtEE98 opened this issue Feb 13, 2024 · 2 comments
Closed
Assignees
Labels
priority: p2 type: question Further information is requested

Comments

@ArtEE98
Copy link

ArtEE98 commented Feb 13, 2024

I am using StreamingPull mechanism to receive messages from the Pub/Sub.

Here is only 2 overriding for default SubscriberFactory settings:

@Bean
    public SubscriberFactory subscriberFactory(
            GcpProjectIdProvider id,
            TransportChannelProvider channelProvider,
            CredentialsProvider credentialsProvider) throws IOException {
        PubSubConfiguration config = new PubSubConfiguration();
        config.initialize(id.getProjectId());
        config.getSubscriber().setParallelPullCount(2); //overriding1
        config.getSubscriber().setMaxDurationPerAckExtension(0); //overriding2
        DefaultSubscriberFactory factory = new DefaultSubscriberFactory(id, config);
        factory.setChannelProvider(channelProvider);
        factory.setPullEndpoint(url());
        factory.setCredentialsProvider(credentialsProvider);
        return factory;
    }

The second overriding helps me to resolve this issue: https://stackoverflow.com/questions/77711978/my-subscriber-receive-a-message-from-gcp-subscription-with-exactly-60-seconds-de

I don't have any other overriding, but when there is no trafic I get this picute of number_of_open_streaming_pull subscription metric:

Screenshot 2024-02-13 at 17 54 46

I know that Pub/Sub prefers to avoid a long-running sticky connection and client library should reopens a StreamingPull connection.. It works well when there is an active traffic. Any advice I can achive a stable reopens even when there is no traffic?

I found some issues about this:
spring-attic/spring-cloud-gcp#1005 - resolved as internal pub/sub issue
spring-attic/spring-cloud-gcp#2552 - adviced to use Synchronous Pull, but I want to go further with Asynchronous pull because for my app lower latency and higher throughput are very important.

We use spring-cloud-gcp-pubsub:5.0

@lqiu96 lqiu96 added type: bug Something isn't working priority: p2 labels Feb 15, 2024
@burkedavison burkedavison added type: question Further information is requested and removed type: bug Something isn't working labels Aug 8, 2024
@ldetmer
Copy link
Contributor

ldetmer commented Aug 21, 2024

Hi @ArtEE98, is this still an issue? Can you share a little more information on the problem please? Is the issue that you want the stream to show up in number_of_open_streaming_pull even if there is no active traffic? Can I ask what your specific use case is?

@ldetmer
Copy link
Contributor

ldetmer commented Sep 4, 2024

I performed a test where I left a subscriber running for 2 hours without traffic. After 2 hours I was able to send a message and have the subscriber reconnect and receive the message. I will close out for now, but @ArtEE98 if you are able to reproduce please send me additional details about your setup.

@ldetmer ldetmer closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants