Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose method returning raw bytes of AMQP message #238

Open
JoshLove-msft opened this issue Jan 26, 2023 · 1 comment
Open

Expose method returning raw bytes of AMQP message #238

JoshLove-msft opened this issue Jan 26, 2023 · 1 comment

Comments

@JoshLove-msft
Copy link
Member

JoshLove-msft commented Jan 26, 2023

          We might want to ask the AMQP team to add an API for it.

Originally posted by @KrzysztofCwalina in Azure/azure-sdk-for-net#33682 (comment)

Currently, we need to either use ToStream or GetPayload to get the raw bytes for the AMQP message. ToStream returns a stream which we need to convert back into bytes. GetPayload returns a list of array segments that we would need to concatenate. Also, GetPayload is only available in hotfix, not in main. It would be good to have an API to get the raw bytes of an AMQP message directly. Similarly, it would be good to have an API that creates the message from bytes, rather than needing to convert the bytes first to a stream.

@xinchen10
Copy link
Member

Is this for usability or performance? At least the new GetBytes API would not improve performance over the ToStream method. The message serialization internally avoids creating a big buffer to hold the entire message. it is always a segmented list of byte arrays for various parts of the message. To give a single byte array (or other types) the new API would need to copy all bytes into the returned type. It is just a matter of where the bytes are copied: in the library or by the user.

The deserialization from a byte array (or something similar) is a valid request. That would save a few lines of code for the user and improve usability a little bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants