Skip to content

Commit

Permalink
Make it possible to configure max_recv_batch_size in Azure service bus.
Browse files Browse the repository at this point in the history
  • Loading branch information
bianpengyuan committed Mar 6, 2024
1 parent 11b07b1 commit 4febeb5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pubsub/azuresb/azuresb.go
Original file line number Diff line number Diff line change
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)

Check warning on line 241 in pubsub/azuresb/azuresb.go

View check run for this annotation

Codecov / codecov/patch

pubsub/azuresb/azuresb.go#L238-L241

Added lines #L238 - L241 were not covered by tests
}
opts.ReceiveBatcherOptions.MaxBatchSize = mrbs

Check warning on line 243 in pubsub/azuresb/azuresb.go

View check run for this annotation

Codecov / codecov/patch

pubsub/azuresb/azuresb.go#L243

Added line #L243 was not covered by tests
}
for param := range q {
return nil, fmt.Errorf("open subscription %v: invalid query parameter %q", u, param)
}
Expand Down

0 comments on commit 4febeb5

Please sign in to comment.