Commit 7b7b6ac
authored
[Event Hubs] Fix sending Uint8Array (Azure#21185)
### Packages impacted by this PR
@azure/event-hubs
### Issues associated with this PR
Fixes Azure#21184
### Describe the problem that is addressed by this PR
When sending a message with `Uint8Array` (which is not strictly a `Buffer`), the client will stringify the payload first, see the last branch in:
https://github.com/Azure/azure-sdk-for-js/blob/7926782dcb48b46cafe51cf1648d9c53b5320ec7/sdk/eventhub/event-hubs/src/dataTransformer.ts#L42-L67
This behavior forces the receiver on the other end to unnecessarily unstringify the payload first.
### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
The design proposed in this PR is to handle the Uint8Array case the same as Buffer but that is a breaking change.
This problem mainly affects sending avro-serialized payloads so alternatively, without introducing breaking changes, the message adapter can convert Uint8Array to a Buffer before handing it to the client for sending. This could work but will likely create confusion for customers who send Uint8Array payloads coming from both the serializer and other sources.
### Are there test cases added in this PR? _(If not, why?)_
Will be added after approval.
### Provide a list of related PRs _(if any)_
N/A
### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_
### Checklists
- [x] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_
- [ ] Added a changelog (if necessary)1 parent b9ef534 commit 7b7b6ac
File tree
4 files changed
+43
-2
lines changed- sdk
- eventhub/event-hubs
- src
- test/public
- schemaregistry/schema-registry-avro/samples-dev
4 files changed
+43
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
Lines changed: 37 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
1267 | 1267 | | |
1268 | 1268 | | |
1269 | 1269 | | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
1270 | 1306 | | |
1271 | 1307 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
0 commit comments