Skip to content

Commit d0e335c

Browse files
authored
pubsub:azpubsub: Allow configuring max_recv_batch_size in via URL
1 parent 11b07b1 commit d0e335c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pubsub/azuresb/azuresb.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import (
6161
"net/url"
6262
"os"
6363
"path"
64+
"strconv"
6465
"strings"
6566
"sync"
6667
"time"
@@ -233,6 +234,14 @@ func (o *URLOpener) OpenSubscriptionURL(ctx context.Context, u *url.URL) (*pubsu
233234
}
234235
opts.ListenerTimeout = d
235236
}
237+
if mrbss := q.Get("max_recv_batch_size"); mrbss != "" {
238+
q.Del("max_recv_batch_size")
239+
mrbs, err := strconv.Atoi(mrbss)
240+
if err != nil {
241+
return nil, fmt.Errorf("open subscription %v: invalid max_recv_batch_size %q: %v", u, mrbss, err)
242+
}
243+
opts.ReceiveBatcherOptions.MaxBatchSize = mrbs
244+
}
236245
for param := range q {
237246
return nil, fmt.Errorf("open subscription %v: invalid query parameter %q", u, param)
238247
}

0 commit comments

Comments
 (0)