Two changes to the
cloud.google.com/go/pubsub package:
First, Client.CreateSubscription now takes a SubscriptionConfig instead of separate arguments for topic, ack deadline and push config. Change
client.CreateSubscription(ctx, id, topic, ackDeadline, pushConfig)
to
client.CreateSubscription(ctx, id, pubsub.SubscriptionConfig{
Topic: topic,
AckDeadline: ackDeadline,
PushConfig: pushConfig,
})
(Also, the PushConfig argument to Subscription.ModifyPushConfig is now a value, not a pointer.)
This change makes way for the addition of new, soon-to-be-released subscription configuration features.
The second change is more significant: we're removing all flow control from publishing (but not subscribing). We feel that our design could use improvement, and we'd rather remove it now, early on, rather than have many clients depend on a flawed client surface.
That means the MaxOutstandingMessages and MaxOutstandingBytes fields of PublishSettings are removed, as is the Topic.TryPublish method. In addition, the Topic.Publish method no longer blocks.
We anticipate that most applications won't notice. For those whose publish rate is so high that undelivered publish messages threaten to consume all of memory, you can implement your own flow control by counting the number of unsent publish messages and bytes, and throttling your calls to Topic.Publish as needed.