PubSub GCP MaxExtension not changeable
wezzle opened this issue · comments
Hi,
I'm trying to use the GCP Pubsub throught github.com/NYTimes/gizmo/pubsub/gcp
but my receiver is running an import with a long duration surpassing the defaultMaxExtension = 60 * time.Second
as defined on gcp.go:51. Causing the message to be resend because the receiver failed to Ack()
the message.
Maybe i'm missing something but i don't see a way to change the MaxExtension on the underlying subscription's ReceiveSettings
I guess this requires a change in the code to make customisable? I'm happy to send in a pull request but would like to hear if it's needed an how you would like to see it implemented?
Congrats! 🎉 You're the first user to run into the 60s limit 😁
I've been bothered by this myself. For now, I'm fine with adding a pubsub.ReceiveSettings
parameter to the NewSubscriber
func.
PRs are definitely appreciated! I'm sure I can find a volunteer for the work if you're busy.
No it's ok, I'm working on it right now anyways.
Would you be in favour of adding a struct to gizmo's pubsub/gcp so including the google cloud pubsub package would not be a requirement? Or just directly use the gpubsub.ReceiveSettings?
EDIT:
One other thought. Not sure on backward compatibility but adding it to the parameter of NewSubscriber might break code for people using one of the ClientOptions. Adding a func on pubsub/gcp's subscriptionImpl SetReceiveSettings
prevents that and keeps the defaults as is?
I'm fine with just using the gpubsub.ReceiveSettings, no need for us to make a config that mimics it.
Let's go with the using a setter func for now. This would be an annoying breaking change.
I'll continue this tomorrow, i'm on European time. One thing I noticed is that with a setter it requires creating a func on both subscriber
as subscriptionImpl
. That seems a bit ugly too but i'll send in the pull request as soon as possible so you can review it.
Let's change the NewSubscriber
to return a *pubsub/gcp.Subscriber
(instead of the interface) so we wont need to alter the overall pubsub.Subscriber
interface and folks can have access to the
new setter method.