watermill
watermill copied to clipboard
MaxOutstandingMessages doesn't seem to be working
Hi,
I'm trying to add flow control on my subscription with MaxOutstandingMessages setting.
I'm setting it to 1, with streaming pull request, but it seems this is not working. I'm always getting all messages delivered at the same time regardless of the number of messages.
Here is the configuration I'm using when creating a subscriber:
import (
"github.com/ThreeDotsLabs/watermill"
"github.com/ThreeDotsLabs/watermill-googlecloud/pkg/googlecloud"
"github.com/ThreeDotsLabs/watermill/message"
"cloud.google.com/go/pubsub"
...
)
func CreateSubscriber(l watermill.LoggerAdapter, cfg config.PubSubConfig, opts SubscriberOptions) (message.Subscriber, error) {
return googlecloud.NewSubscriber(
googlecloud.SubscriberConfig{
GenerateSubscriptionName: opts.SubscriptionNameFn,
SubscriptionConfig: pubsub.SubscriptionConfig{
RetainAckedMessages: false,
},
ReceiveSettings: pubsub.ReceiveSettings{
MaxOutstandingMessages: 1,
},
ProjectID: cfg.ProjectID,
TopicProjectID: cfg.TopicProjectID,
ClientOptions: setCredentials(cfg),
DoNotCreateTopicIfMissing: true,
},
l,
)
}