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

MaxOutstandingMessages doesn't seem to be working #412

Open
ATahhan opened this issue Nov 23, 2023 · 0 comments
Open

MaxOutstandingMessages doesn't seem to be working #412

ATahhan opened this issue Nov 23, 2023 · 0 comments

Comments

@ATahhan
Copy link

ATahhan commented Nov 23, 2023

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.
image

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,
	)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant