-
Notifications
You must be signed in to change notification settings - Fork 315
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
Allow setting Expiration Policy on Subscriptions created via Pub Sub Binder #2876
Comments
@jmitash Thanks for bringing this up. I didn't realize there was this 31 day expiration default. What's the error message that you get when this happens? I think this is a very reasonable feature request. @burkedavison WDYT? |
According to the docs, basically if anything is connecting to the subscription, it counts as activity and resets the deletion timer:
So I don't think people would see an error because the subscription should not be expired while still in active use. But I'm not 100% certain of that because I'm not sure how exactly they count those things (e.g. what makes a pull "active"? do only new connections count?). In my case, these streams that are deleted are related to a job initiated by a manual CSV upload. The job is only run a few times a year. So instead of leaving our SCS applications running idle 99% of the time, we set them up so that they start off scaled to zero until there is a backlog of messages. This is done by a different tool which uses the Google Cloud Monitoring API, so it does not count as subscription activity. Because the normal state is not running at all, nothing is pulling when the subscription is deleted, the subscriptions reach the 31 day expiration and get deleted. But because once the application does start up and creates all the subscriptions again, there is no error, but the messages that should have gone to that subscription before then are lost. |
SGTM |
@jmitash Thanks for the explanation. If you are comfortable opening a pull request for this, we will take a look. |
…2876) (@jmitash) (#2897) * feat: configurable expiration policy on auto-created subscriptions (#2894) * Add properties for Binder expiration policy * Set Expiration Policy when creating Subscription * Treat non-positive durations as "never expire" * Use Google Java formatting * docs: add expiration policy section to pubsub * chore: access autocreate value from properties * chore: fix test * docs: correct never expire logic * chore: add example of setting expirationPolicy.ttl to pubsub-stream functional sample * docs: update stream binder docs with configuration options * Update docs/src/main/asciidoc/pubsub.adoc Co-authored-by: Mike Eltsufin <meltsufin@google.com> * Update docs/src/main/asciidoc/pubsub.adoc Co-authored-by: Mike Eltsufin <meltsufin@google.com> * Update docs/src/main/asciidoc/pubsub.adoc Co-authored-by: Mike Eltsufin <meltsufin@google.com> * Update docs/src/main/asciidoc/spring-stream.adoc Co-authored-by: Mike Eltsufin <meltsufin@google.com> * Update docs/src/main/asciidoc/spring-stream.adoc Co-authored-by: Mike Eltsufin <meltsufin@google.com> * Update docs/src/main/asciidoc/spring-stream.adoc Co-authored-by: Mike Eltsufin <meltsufin@google.com> --------- Co-authored-by: Jacob Mitash <jacob@mitash.org> Co-authored-by: Mike Eltsufin <meltsufin@google.com>
Fixed in #2897 |
When Pub Sub subscriptions are created, if no expiration policy is specified they expire by default in 31 days. In the setup I am working with, it is common for there to be little activity for long periods of times on some streams. For some of these streams, we spin up consumers reactively once a batch of messages are queued in the subscription (as opposed to having them idle year-round). However, because the subscription is quiet for so long, sometimes it is automatically deleted in between batches. Since there is no way to set the expiration policy on the Binder's auto-created subscriptions, I must create them externally.
I would like to be able to configure the expiration policy for auto-created subscriptions so I don't have to rely on external setup.
If desired, I am happy to contribute this change. I have already prepared it for my own use: main...jmitash:spring-cloud-gcp:feat/pubsub-binder-expiration-config.
The text was updated successfully, but these errors were encountered: