Skip to content

Commit

Permalink
pubsub:azpubsub: Allow configuring max_recv_batch_size in via URL
Browse files Browse the repository at this point in the history
  • Loading branch information
bianpengyuan committed Mar 6, 2024
1 parent 11b07b1 commit d0e335c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pubsub/azuresb/azuresb.go
Expand Up @@ -61,6 +61,7 @@ import (
"net/url"
"os"
"path"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -233,6 +234,14 @@ func (o *URLOpener) OpenSubscriptionURL(ctx context.Context, u *url.URL) (*pubsu
}
opts.ListenerTimeout = d
}
if mrbss := q.Get("max_recv_batch_size"); mrbss != "" {
q.Del("max_recv_batch_size")
mrbs, err := strconv.Atoi(mrbss)
if err != nil {
return nil, fmt.Errorf("open subscription %v: invalid max_recv_batch_size %q: %v", u, mrbss, err)
}
opts.ReceiveBatcherOptions.MaxBatchSize = mrbs
}
for param := range q {
return nil, fmt.Errorf("open subscription %v: invalid query parameter %q", u, param)
}
Expand Down

0 comments on commit d0e335c

Please sign in to comment.