Commit e3b2ef6
committed
Cap ServiceBusMessageBatch size at 1 MB to match broker enforcement
The Service Bus broker enforces a 1 MB batch size limit regardless of the
max-message-size advertised on the AMQP link. Premium partitioned namespaces
advertise 100 MB on the link, causing tryAddMessage() to accept batches the
broker will reject.
Cap batch creation in ServiceBusSenderAsyncClient.createMessageBatch() at
1 MB (MAX_BATCH_SIZE_BYTES). This is the single enforcement point: both
sendMessages(iterable) and scheduleMessages(iterable) call createMessageBatch
internally. Single-message paths (sendMessage, scheduleMessage) are NOT
capped since the 1 MB limit is batch-specific and individual messages on
Premium can validly exceed 1 MB up to the per-entity limit.
When a user requests a batch size exceeding 1 MB via
CreateMessageBatchOptions, throw ServiceBusException.
Tracking: azure-service-bus#708
ICM: 510000007938791 parent 66f5537 commit e3b2ef6
2 files changed
Lines changed: 343 additions & 4 deletions
File tree
- sdk/servicebus/azure-messaging-servicebus/src
- main/java/com/azure/messaging/servicebus
- test/java/com/azure/messaging/servicebus
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
225 | 235 | | |
226 | 236 | | |
227 | 237 | | |
| |||
463 | 473 | | |
464 | 474 | | |
465 | 475 | | |
466 | | - | |
| 476 | + | |
467 | 477 | | |
468 | 478 | | |
469 | 479 | | |
470 | | - | |
471 | | - | |
| 480 | + | |
| 481 | + | |
472 | 482 | | |
473 | 483 | | |
474 | | - | |
| 484 | + | |
475 | 485 | | |
476 | 486 | | |
477 | 487 | | |
| |||
0 commit comments